Class: Koz::BasePoti
- Inherits:
-
Object
- Object
- Koz::BasePoti
- Defined in:
- lib/koz/poti.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
._entrance ⇒ Object
Returns the value of attribute _entrance.
Class Method Summary collapse
- ._call(event) ⇒ Object
- .call(event) ⇒ Object
- .class_initialize ⇒ Object
- .enter(&blk) ⇒ Object
- .inheritance(&blk) ⇒ Object
- .inherited(klass) ⇒ Object
- .inspect ⇒ Object
- .to_proc ⇒ Object
Class Attribute Details
._entrance ⇒ Object
Returns the value of attribute _entrance.
12 13 14 |
# File 'lib/koz/poti.rb', line 12 def _entrance @_entrance end |
Class Method Details
._call(event) ⇒ Object
39 40 41 |
# File 'lib/koz/poti.rb', line 39 def _call(event) event end |
.call(event) ⇒ Object
35 36 37 |
# File 'lib/koz/poti.rb', line 35 def call event _call event end |
.class_initialize ⇒ Object
7 8 9 10 |
# File 'lib/koz/poti.rb', line 7 def class_initialize @_entrance = -> (event) {} @_class = 'Poti' end |
.enter(&blk) ⇒ Object
31 32 33 |
# File 'lib/koz/poti.rb', line 31 def enter &blk @_entrance = blk end |
.inheritance(&blk) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/koz/poti.rb', line 14 def inheritance(&blk) klass = Class.new(self) if blk case blk.arity when 0 klass.class_eval(&blk) when 1 blk.call(klass) end end klass end |
.inherited(klass) ⇒ Object
27 28 29 |
# File 'lib/koz/poti.rb', line 27 def inherited klass klass.class_initialize end |
.inspect ⇒ Object
47 48 49 |
# File 'lib/koz/poti.rb', line 47 def inspect name ? "#{name} < #{@_class}" : "#{@_class}.inheritance" end |
.to_proc ⇒ Object
43 44 45 |
# File 'lib/koz/poti.rb', line 43 def to_proc -> (event) { self.call(event) } end |