Module: Ruckus::StructureAtCreate::ClassMethods

Defined in:
lib/ruckus/structure/atcreate.rb

Instance Method Summary collapse

Instance Method Details

#at_create(arg = nil, &block) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/ruckus/structure/atcreate.rb', line 8

def at_create(arg=nil, &block)
    if not block_given?
        raise "need a callback function" if not arg
        arg = arg.intern if not arg.kind_of? Symbol
        block = lambda { send(arg) }
    end

    self.initializers << block
end

#override(field, val) ⇒ Object



18
19
20
# File 'lib/ruckus/structure/atcreate.rb', line 18

def override(field, val)
    at_create { self[field] = val }
end