Class: Predicated::And

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



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

def self.shorthand; :And end

Instance Method Details

#evaluateObject



76
77
78
# File 'lib/predicated/evaluate.rb', line 76

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

#fill_in(placeholder_replacement) ⇒ Object



15
16
17
# File 'lib/predicated/simple_templated_predicate.rb', line 15

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

#joining_strObject



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

def joining_str; " and " end

#to_arel(arel_table) ⇒ Object



10
11
12
# File 'lib/predicated/to/arel.rb', line 10

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

#to_json_structObject



15
16
17
# File 'lib/predicated/to/json.rb', line 15

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

#to_solrObject



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

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

#to_xml(indent = "") ⇒ Object



15
16
17
# File 'lib/predicated/to/xml.rb', line 15

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