Class: Suture::Value::Observation

Inherits:
Object
  • Object
show all
Defined in:
lib/suture/value/observation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ Observation

Returns a new instance of Observation.



7
8
9
10
11
12
13
# File 'lib/suture/value/observation.rb', line 7

def initialize(attrs)
  @id = attrs[:id]
  @name = attrs[:name]
  @args = attrs[:args]
  @return_value = attrs[:return]
  @error = attrs[:error]
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



5
6
7
# File 'lib/suture/value/observation.rb', line 5

def args
  @args
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/suture/value/observation.rb', line 5

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/suture/value/observation.rb', line 5

def name
  @name
end

Instance Method Details

#resultObject



15
16
17
# File 'lib/suture/value/observation.rb', line 15

def result
  @expectation ||= @error ? Result.errored(@error) : Result.returned(@return_value)
end