Class: Nyanko::ActiveIf::Any

Inherits:
Object
  • Object
show all
Defined in:
lib/nyanko/active_if.rb

Instance Method Summary collapse

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

#definitionsObject



54
55
56
# File 'lib/nyanko/active_if.rb', line 54

def definitions
  @labels.map {|label| ActiveIf.find(label) }
end

#to_blockObject



46
47
48
49
50
51
52
# File 'lib/nyanko/active_if.rb', line 46

def to_block
  proc do |context, options|
    definitions.any? do |definition|
      definition.call(context, options)
    end
  end
end