Class: Statefulton::Statefulton
- Inherits:
-
Object
- Object
- Statefulton::Statefulton
- Defined in:
- lib/statefulton/statefulton.rb
Instance Attribute Summary collapse
-
#instance ⇒ Object
readonly
Returns the value of attribute instance.
Instance Method Summary collapse
- #builder(&block) ⇒ Object
- #expects(string) ⇒ Object
-
#initialize(&block) ⇒ Statefulton
constructor
A new instance of Statefulton.
- #make(string, &block) ⇒ Object
- #reset! ⇒ Object
Constructor Details
#initialize(&block) ⇒ Statefulton
Returns a new instance of Statefulton.
5 6 7 |
# File 'lib/statefulton/statefulton.rb', line 5 def initialize &block instance_eval &block end |
Instance Attribute Details
#instance ⇒ Object (readonly)
Returns the value of attribute instance.
3 4 5 |
# File 'lib/statefulton/statefulton.rb', line 3 def instance @instance end |
Instance Method Details
#builder(&block) ⇒ Object
9 10 11 |
# File 'lib/statefulton/statefulton.rb', line 9 def builder &block @builder = block end |
#expects(string) ⇒ Object
19 20 21 22 23 |
# File 'lib/statefulton/statefulton.rb', line 19 def expects string define_singleton_method string do instance or fail Exceptions::NoInstance end end |
#make(string, &block) ⇒ Object
13 14 15 16 17 |
# File 'lib/statefulton/statefulton.rb', line 13 def make string, &block define_singleton_method string do build_instance &block end end |
#reset! ⇒ Object
25 26 27 |
# File 'lib/statefulton/statefulton.rb', line 25 def reset! @instance = nil end |