Class: MetaField::MetaProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/meta_field/proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ MetaProxy

Returns a new instance of MetaProxy.



3
4
5
6
# File 'lib/meta_field/proxy.rb', line 3

def initialize(klass)
  @klass = klass
  @type = klass.base_class.to_s
end

Instance Method Details

#[](basename) ⇒ Object



7
8
9
10
# File 'lib/meta_field/proxy.rb', line 7

def [](basename)
  t = MetaField::Meta.arel_table
  NodeProxy.new(@klass.meta_fields[basename.to_sym][0], t[:obj_type].eq(@type).and(t[:basename].eq(basename.to_s)))
end