Class: Koz::BasePoti

Inherits:
Object
  • Object
show all
Defined in:
lib/koz/poti.rb

Direct Known Subclasses

Poti

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

._entranceObject

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_initializeObject



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

.inspectObject



47
48
49
# File 'lib/koz/poti.rb', line 47

def inspect
  name ? "#{name} < #{@_class}" : "#{@_class}.inheritance"
end

.to_procObject



43
44
45
# File 'lib/koz/poti.rb', line 43

def to_proc
  -> (event) { self.call(event) }
end