Class: Brainstorm::Selector

Inherits:
Neuron
  • Object
show all
Defined in:
lib/brainstorm.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Neuron

#>>

Constructor Details

#initialize(*args, &block) ⇒ Selector

Returns a new instance of Selector.



90
91
92
# File 'lib/brainstorm.rb', line 90

def initialize(*args, &block)
  @function = Brainstorm.function_for(*args, &block)
end

Instance Attribute Details

#functionObject

Returns the value of attribute function.



88
89
90
# File 'lib/brainstorm.rb', line 88

def function
  @function
end

Instance Method Details

#call(item) ⇒ Object



94
95
96
97
98
99
100
101
102
# File 'lib/brainstorm.rb', line 94

def call(item)
  if @function.call(item)
    fire start
    fire value(item)
    fire finish
  else
    fire value(item)
  end
end