Sha256: ec4066ce8fdd981c802279ab5153fe1cf078418d30ae194f0aeae4100322a233
Contents?: true
Size: 948 Bytes
Versions: 4
Compression:
Stored size: 948 Bytes
Contents
module Piglet module Field class Reference # :nodoc: include Field def initialize(name, relation=nil, options=nil) options ||= {} @name, @parent = name, relation @explicit_ancestry = options[:explicit_ancestry] || false @type = options[:type] end def simple? true end def field(name) Reference.new(name, self, :explicit_ancestry => true) end def method_missing(name, *args) if name.to_s =~ /^\w+$/ && args.empty? field(name) else super end end def [](n) field("\$#{n}") end def to_s if @explicit_ancestry if @parent.respond_to?(:alias) "#{@parent.alias}.#{@name.to_s}" else "#{@parent}.#{@name.to_s}" end else @name.to_s end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
piglet-0.2.4 | lib/piglet/field/reference.rb |
piglet-0.2.3 | lib/piglet/field/reference.rb |
piglet-0.2.2 | lib/piglet/field/reference.rb |
piglet-0.2.0 | lib/piglet/field/reference.rb |