Class: StepUp::Driver::Base
- Inherits:
-
Object
- Object
- StepUp::Driver::Base
- Defined in:
- lib/step-up/driver.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cache ⇒ Object
readonly
Returns the value of attribute cache.
-
#mask ⇒ Object
readonly
Returns the value of attribute mask.
Instance Method Summary collapse
-
#initialize(mask = nil) ⇒ Base
constructor
A new instance of Base.
- #method_missing(called_method, *args, &block) ⇒ Object
- #unsupported_scm_banner ⇒ Object
Constructor Details
#initialize(mask = nil) ⇒ Base
Returns a new instance of Base.
7 8 9 10 |
# File 'lib/step-up/driver.rb', line 7 def initialize(mask = nil) @mask = Parser::VersionMask.new(mask || CONFIG.versioning.version_mask) @cache = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(called_method, *args, &block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/step-up/driver.rb', line 12 def method_missing(called_method, *args, &block) if called_method.to_s =~ /^cached_(.+)$/ method = $1 if respond_to?(method) if block_given? send(method, *args, &block) else cache[method] ||= {} cache[method][args] ||= send(method, *args) end else super end else super end end |
Instance Attribute Details
#cache ⇒ Object (readonly)
Returns the value of attribute cache.
6 7 8 |
# File 'lib/step-up/driver.rb', line 6 def cache @cache end |
#mask ⇒ Object (readonly)
Returns the value of attribute mask.
5 6 7 |
# File 'lib/step-up/driver.rb', line 5 def mask @mask end |
Instance Method Details
#unsupported_scm_banner ⇒ Object
30 31 32 |
# File 'lib/step-up/driver.rb', line 30 def "Unsupported installed SCM version" end |