Class: ExampleBlock
- Inherits:
-
Object
- Object
- ExampleBlock
- Defined in:
- lib/matest/example_block.rb
Instance Attribute Summary collapse
-
#assertion ⇒ Object
readonly
Returns the value of attribute assertion.
-
#assertion_sexp ⇒ Object
readonly
Returns the value of attribute assertion_sexp.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#sexp ⇒ Object
readonly
Returns the value of attribute sexp.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(block) ⇒ ExampleBlock
constructor
A new instance of ExampleBlock.
- #source_location ⇒ Object
Constructor Details
#initialize(block) ⇒ ExampleBlock
Returns a new instance of ExampleBlock.
11 12 13 14 15 16 17 18 19 |
# File 'lib/matest/example_block.rb', line 11 def initialize(block) @block = block @code = generate_code @sexp = Ripper::SexpBuilder.new(code).parse.last @assertion_sexp = @sexp.last @assertion = Sorcerer.source(assertion_sexp) end |
Instance Attribute Details
#assertion ⇒ Object (readonly)
Returns the value of attribute assertion.
8 9 10 |
# File 'lib/matest/example_block.rb', line 8 def assertion @assertion end |
#assertion_sexp ⇒ Object (readonly)
Returns the value of attribute assertion_sexp.
9 10 11 |
# File 'lib/matest/example_block.rb', line 9 def assertion_sexp @assertion_sexp end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
5 6 7 |
# File 'lib/matest/example_block.rb', line 5 def block @block end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
6 7 8 |
# File 'lib/matest/example_block.rb', line 6 def code @code end |
#sexp ⇒ Object (readonly)
Returns the value of attribute sexp.
7 8 9 |
# File 'lib/matest/example_block.rb', line 7 def sexp @sexp end |
Instance Method Details
#call ⇒ Object
21 22 23 |
# File 'lib/matest/example_block.rb', line 21 def call block.call end |
#source_location ⇒ Object
25 26 27 |
# File 'lib/matest/example_block.rb', line 25 def source_location block.source_location end |