lib/piglet/field/reference.rb in piglet-0.1.2 vs lib/piglet/field/reference.rb in piglet-0.2.0
- old
+ new
@@ -1,29 +1,34 @@
module Piglet
module Field
class Reference # :nodoc:
- include Operators
+ 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?
- Reference.new(name, self, :explicit_ancestry => true)
+ field(name)
else
super
end
end
def [](n)
- Reference.new("\$#{n}", self, :explicit_ancestry => true)
+ field("\$#{n}")
end
def to_s
if @explicit_ancestry
if @parent.respond_to?(:alias)
\ No newline at end of file