Class: Rulz::Definer

Inherits:
Object
  • Object
show all
Defined in:
lib/rulz/definer.rb

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Definer

Returns a new instance of Definer.



4
5
6
# File 'lib/rulz/definer.rb', line 4

def initialize(klass)
  @klass = klass
end

Instance Method Details

#action(name, &block) ⇒ Object



12
13
14
# File 'lib/rulz/definer.rb', line 12

def action(name, &block)
  Rulz::Action.new(name, @klass, block)
end

#attribute(attr, &block) ⇒ Object



20
21
22
# File 'lib/rulz/definer.rb', line 20

def attribute(attr, &block)
  Rulz::Attribute::Block.new(attr, @klass, &block)
end

#condition(name, &block) ⇒ Object



8
9
10
# File 'lib/rulz/definer.rb', line 8

def condition(name, &block)
  Rulz::Condition.new(name, @klass, block)
end

#rule(&block) ⇒ Object



16
17
18
# File 'lib/rulz/definer.rb', line 16

def rule(&block)
  Rulz::Rule.new(@klass, block)
end