Module: WirelessModel::ClassMethods

Defined in:
lib/wireless_model.rb

Instance Method Summary collapse

Instance Method Details

#const_missing(sym) ⇒ Object



27
28
29
30
31
# File 'lib/wireless_model.rb', line 27

def const_missing(sym)
  return record_module.const_get(sym) rescue
  return resource_module.const_get(sym) rescue
  super
end

#record_module(*args) ⇒ Object



17
18
19
20
# File 'lib/wireless_model.rb', line 17

def record_module(*args)
  @record_module = args.first unless args.empty?
  (@record_module || parents.first.name).constantize rescue nil
end

#resource_module(*args) ⇒ Object



22
23
24
25
# File 'lib/wireless_model.rb', line 22

def resource_module(*args)
  @resource_module = args.first unless args.empty?
  (@resource_module || "#{parents.first}::Resources").constantize rescue nil
end