Class: Chanko::ActiveIf::Block
- Inherits:
-
Object
- Object
- Chanko::ActiveIf::Block
- Defined in:
- lib/chanko/active_if.rb
Instance Method Summary collapse
- #block ⇒ Object
- #call(context, options) ⇒ Object
-
#initialize(*conditions) ⇒ Block
constructor
A new instance of Block.
Constructor Details
#initialize(*conditions) ⇒ Block
Returns a new instance of Block.
53 54 55 |
# File 'lib/chanko/active_if.rb', line 53 def initialize(*conditions) @conditions = conditions end |
Instance Method Details
#block ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'lib/chanko/active_if.rb', line 61 def block condition = @conditions.first if condition.kind_of?(Block) condition else ActiveIf.find(condition) or raise NoConditionFound, condition end end |
#call(context, options) ⇒ Object
57 58 59 |
# File 'lib/chanko/active_if.rb', line 57 def call(context, ) block.call(context, ) end |