Class: ADSL::FOL::Or
Instance Attribute Summary collapse
-
#objs ⇒ Object
readonly
Returns the value of attribute objs.
Instance Method Summary collapse
-
#initialize(*objs) ⇒ Or
constructor
A new instance of Or.
- #resolve_spass ⇒ Object
Constructor Details
#initialize(*objs) ⇒ Or
Returns a new instance of Or.
86 87 88 |
# File 'lib/adsl/fol/first_order_logic.rb', line 86 def initialize(*objs) @objs = objs.flatten end |
Instance Attribute Details
#objs ⇒ Object (readonly)
Returns the value of attribute objs.
84 85 86 |
# File 'lib/adsl/fol/first_order_logic.rb', line 84 def objs @objs end |
Instance Method Details
#resolve_spass ⇒ Object
90 91 92 93 94 95 96 97 98 |
# File 'lib/adsl/fol/first_order_logic.rb', line 90 def resolve_spass children = @objs.map{ |child| child.resolve_spass } children = children.map{ |child| child.match('\Aor\((.*)\)\z') ? $1.split_by_zero_level_comma : child }.flatten children.delete_if{ |a| a == 'false' } return 'true' if children.include? 'true' return 'false' if children.empty? return children.first if children.length == 1 return "or(#{children.join(', ')})" end |