Class: Barometer::Support::Matchers::Walker

Inherits:
Object
  • Object
show all
Defined in:
lib/barometer/support/matchers/walker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Walker

Returns a new instance of Walker.



7
8
9
# File 'lib/barometer/support/matchers/walker.rb', line 7

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/barometer/support/matchers/walker.rb', line 5

def value
  @value
end

Instance Method Details

#follow(paths) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/barometer/support/matchers/walker.rb', line 11

def follow(paths)
  path_value = value
  paths.each do |path|
    path_value = path_value.send(path)
  end
  if path_value.respond_to?(:strftime)
    path_value.strftime("%Y-%m-%d %H:%M:%S %z")
  else
    path_value.to_s
  end
end