lib/cloud_sesame/query/ast/literal.rb in CloudSesame-0.4.2 vs lib/cloud_sesame/query/ast/literal.rb in CloudSesame-0.4.3
- old
+ new
@@ -7,20 +7,25 @@
ESCAPE_QUATE = "\\'"
attr_accessor :field
attr_reader :options, :value
- def initialize(field = nil, value = nil, options = {}, &block)
+ def initialize(field, value, options = {}, &block)
@field = field
@value = Value.parse value if value
- @value = Value.parse ValueEvaluator.new.instance_exec &block if block_given?
- @options = options || {}
- applied[@value] = true
+ @value = Value.parse(ValueEvaluator.new.instance_exec &block) if block_given?
+
+ @options = options
+ is_included
end
- def is_for(field, options)
+ def is_for(field, options = {})
@field = field
@options = options.merge @options
+ end
+
+ def is_included
+ applied[value] = true
end
def is_excluded
applied[value] = applied[value] == false ? true : false
end