Class: Statemachine::StubContext
- Inherits:
-
Object
- Object
- Statemachine::StubContext
- Defined in:
- lib/statemachine/stub_context.rb
Instance Attribute Summary collapse
-
#statemachine ⇒ Object
Returns the value of attribute statemachine.
Instance Method Summary collapse
- #__generic_method(name, *args) ⇒ Object
-
#initialize(options = {}) ⇒ StubContext
constructor
A new instance of StubContext.
- #method(name) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ StubContext
Returns a new instance of StubContext.
5 6 7 |
# File 'lib/statemachine/stub_context.rb', line 5 def initialize( = {}) @verbose = [:verbose] end |
Instance Attribute Details
#statemachine ⇒ Object
Returns the value of attribute statemachine.
9 10 11 |
# File 'lib/statemachine/stub_context.rb', line 9 def statemachine @statemachine end |
Instance Method Details
#__generic_method(name, *args) ⇒ Object
18 19 20 21 22 |
# File 'lib/statemachine/stub_context.rb', line 18 def __generic_method(name, *args) if !defined?($IS_TEST) puts "action invoked: #{name}(#{args.join(", ")}) #{block_given? ? "with block" : ""}" if @verbose end end |
#method(name) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/statemachine/stub_context.rb', line 11 def method(name) super(name) rescue self.class.class_eval "def #{name}(*args, &block); __generic_method(:#{name}, *args, &block); end" return super(name) end |