Class: Tryouts::Drill::Reality
- Defined in:
- lib/tryouts/drill/reality.rb
Overview
Reality
Contains the actual response of a Drill
Instance Attribute Summary collapse
-
#command ⇒ Object
For :cli drills only.
-
#ecode ⇒ Object
Returns the value of attribute ecode.
-
#error ⇒ Object
Returns the value of attribute error.
-
#etype ⇒ Object
Returns the value of attribute etype.
-
#stash ⇒ Object
An ordered hash taken from the DrillContext that created this Reality.
-
#trace ⇒ Object
Returns the value of attribute trace.
Attributes inherited from Response
Instance Method Summary collapse
- #==(dream) ⇒ Object
- #comparison_value(dream) ⇒ Object
-
#initialize ⇒ Reality
constructor
A new instance of Reality.
Methods inherited from Response
Constructor Details
Instance Attribute Details
#command ⇒ Object
For :cli drills only. Contains the shell command string.
15 16 17 |
# File 'lib/tryouts/drill/reality.rb', line 15 def command @command end |
#ecode ⇒ Object
Returns the value of attribute ecode.
12 13 14 |
# File 'lib/tryouts/drill/reality.rb', line 12 def ecode @ecode end |
#error ⇒ Object
Returns the value of attribute error.
10 11 12 |
# File 'lib/tryouts/drill/reality.rb', line 10 def error @error end |
#etype ⇒ Object
Returns the value of attribute etype.
13 14 15 |
# File 'lib/tryouts/drill/reality.rb', line 13 def etype @etype end |
#stash ⇒ Object
An ordered hash taken from the DrillContext that created this Reality.
9 10 11 |
# File 'lib/tryouts/drill/reality.rb', line 9 def stash @stash end |
#trace ⇒ Object
Returns the value of attribute trace.
11 12 13 |
# File 'lib/tryouts/drill/reality.rb', line 11 def trace @trace end |
Instance Method Details
#==(dream) ⇒ Object
20 21 22 |
# File 'lib/tryouts/drill/reality.rb', line 20 def ==(dream) Response.compare(dream, self) end |
#comparison_value(dream) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/tryouts/drill/reality.rb', line 24 def comparison_value(dream) case dream.format when :proc test = dream.output (test.arity > 0 ? test.call(@output) : test.call) when :exception @etype when :respond_to?, :is_a?, :kind_of?, :grep @output.send(dream.format, dream.output) when nil @output else return nil if @output.nil? if !dream.format.is_a?(Symbol) "This dream format is not a Symbol: #{dream.format}" elsif @output.respond_to?(dream.format) @output.send(dream.format) else @output end end end |