Class: StepUp::Driver::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/step-up/driver.rb

Direct Known Subclasses

Git

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#cacheObject (readonly)

Returns the value of attribute cache.


6
7
8
# File 'lib/step-up/driver.rb', line 6

def cache
  @cache
end

#maskObject (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_bannerObject


30
31
32
# File 'lib/step-up/driver.rb', line 30

def unsupported_scm_banner
  "Unsupported installed SCM version"
end