Class: Rulz::Attribute::Block

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

Instance Method Summary collapse

Constructor Details

#initialize(attr, klass, &block) ⇒ Block

Returns a new instance of Block.



4
5
6
7
8
# File 'lib/rulz/attribute.rb', line 4

def initialize(attr, klass, &block)
  @attr = attr
  @klass = klass
  instance_eval &block
end

Instance Method Details

#condition(name, &block) ⇒ Object



10
11
12
# File 'lib/rulz/attribute.rb', line 10

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

#type(kind) ⇒ Object



14
15
16
# File 'lib/rulz/attribute.rb', line 14

def type(kind)
  Rulz::Conditions.load_conditions(@klass, @attr, kind)
end