Class: CanDo::Dsl::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/can_do/dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, &block) ⇒ Rule

Returns a new instance of Rule.



51
52
53
54
# File 'lib/can_do/dsl.rb', line 51

def initialize(reason, &block)
  @reason = reason || "Unknown Reason"
  @block = block
end

Instance Attribute Details

#reasonObject (readonly)

Returns the value of attribute reason.



49
50
51
# File 'lib/can_do/dsl.rb', line 49

def reason
  @reason
end

Instance Method Details

#call(object, noun) ⇒ Object



56
57
58
# File 'lib/can_do/dsl.rb', line 56

def call(object, noun)
  @block.call(object)
end