Class: Nyanko::ActiveIf::Any
- Inherits:
-
Object
- Object
- Nyanko::ActiveIf::Any
- Defined in:
- lib/nyanko/active_if.rb
Instance Method Summary collapse
- #definitions ⇒ Object
-
#initialize(*labels) ⇒ Any
constructor
A new instance of Any.
- #to_block ⇒ Object
Constructor Details
#initialize(*labels) ⇒ Any
Returns a new instance of Any.
42 43 44 |
# File 'lib/nyanko/active_if.rb', line 42 def initialize(*labels) @labels = labels end |
Instance Method Details
#definitions ⇒ Object
54 55 56 |
# File 'lib/nyanko/active_if.rb', line 54 def definitions @labels.map {|label| ActiveIf.find(label) } end |
#to_block ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/nyanko/active_if.rb', line 46 def to_block proc do |context, | definitions.any? do |definition| definition.call(context, ) end end end |