module Aduki::ClassMethods

Public Instance Methods

aduki(types) click to toggle source
# File lib/aduki.rb, line 157
def aduki types
  @@types[self] ||= { }
  @@types[self] = @@types[self].merge types
  types.each do |attr, k|
    attr = attr.to_sym
    attr_reader attr unless method_defined? attr
    attr_writer attr unless method_defined? :"#{attr}="
  end
end
aduki_initialize(name, initial_klass, type=:notset) click to toggle source
# File lib/aduki.rb, line 167
def aduki_initialize name, initial_klass, type=:notset
  type = (type == :notset) ? initial_klass : type
  aduki(name => type) if type
  initializer_name = :"aduki_initialize_#{name}"
  define_method initializer_name do
    send :"#{name}=", initial_klass.new
  end
  @@initializers[self] ||= []
  @@initializers[self] << initializer_name
end
aduki_type_for_attribute_name(name) click to toggle source
# File lib/aduki.rb, line 178
def aduki_type_for_attribute_name name
  hsh = @@types[self]
  hsh ? hsh[name.to_sym] : nil
end
attr_finder(finder, id, *args) click to toggle source
# File lib/aduki.rb, line 187
def attr_finder finder, id, *args
  class_eval Aduki::AttrFinder.attr_finders_text(finder, id, *args)
end
attr_many_finder(finder, id, name, options={ }) click to toggle source
# File lib/aduki.rb, line 191
def attr_many_finder finder, id, name, options={ }
  class_eval Aduki::AttrFinder.one2many_attr_finder_text(finder, id, name, options)
end
get_aduki_initializers() click to toggle source
# File lib/aduki.rb, line 183
def get_aduki_initializers
  @@initializers[self] || []
end