Class: Predicated::Or

Inherits:
Binary show all
Includes:
Conjunction, Container, ContainerToString, ContainerToXml, JsonStructToJsonStr
Defined in:
lib/predicated/print.rb,
lib/predicated/to/xml.rb,
lib/predicated/to/arel.rb,
lib/predicated/to/json.rb,
lib/predicated/to/solr.rb,
lib/predicated/evaluate.rb,
lib/predicated/predicate.rb,
lib/predicated/to/sentence.rb,
lib/predicated/simple_templated_predicate.rb

Instance Attribute Summary

Attributes inherited from Binary

#left, #right

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Conjunction

#to_negative_sentence, #to_sentence

Methods included from JsonStructToJsonStr

#to_json_str

Methods included from ContainerToString

#inspect

Methods inherited from Binary

#initialize, #to_s

Methods included from Binary::ValueEquality

#==

Methods included from Binary::FlipThroughMe

#each

Methods included from PrintSupport

#inspect

Methods inherited from Predicate

from_callable_object, from_json_str, from_json_struct, from_ruby_code_string, from_url_part, from_xml

Constructor Details

This class inherits a constructor from Predicated::Binary

Class Method Details

.shorthandObject



80
# File 'lib/predicated/predicate.rb', line 80

def self.shorthand; :Or end

Instance Method Details

#evaluateObject



83
84
85
# File 'lib/predicated/evaluate.rb', line 83

def evaluate
  boolean_or_evaluate(left) || boolean_or_evaluate(right)
end

#fill_in(placeholder_replacement) ⇒ Object



21
22
23
# File 'lib/predicated/simple_templated_predicate.rb', line 21

def fill_in(placeholder_replacement)
  Or.new(left.fill_in(placeholder_replacement), right.fill_in(placeholder_replacement))
end

#joining_strObject



17
# File 'lib/predicated/to/sentence.rb', line 17

def joining_str; " or " end

#to_arel(arel_table) ⇒ Object



16
17
18
# File 'lib/predicated/to/arel.rb', line 16

def to_arel(arel_table)
  Arel::Predicates::Or.new(left.to_arel(arel_table), right.to_arel(arel_table))
end

#to_json_structObject



22
23
24
# File 'lib/predicated/to/json.rb', line 22

def to_json_struct
  {"or" => [left.to_json_struct, right.to_json_struct]}
end

#to_solrObject



6
# File 'lib/predicated/to/solr.rb', line 6

def to_solr; "(#{left.to_solr} OR #{right.to_solr})" end

#to_xml(indent = "") ⇒ Object



22
23
24
# File 'lib/predicated/to/xml.rb', line 22

def to_xml(indent="")
  to_xml_with_tag_name(indent, "or")
end