Class: ADSL::FOL::And
Instance Attribute Summary collapse
-
#objs ⇒ Object
readonly
Returns the value of attribute objs.
Instance Method Summary collapse
-
#initialize(*objs) ⇒ And
constructor
A new instance of And.
- #resolve_spass ⇒ Object
Constructor Details
#initialize(*objs) ⇒ And
Returns a new instance of And.
68 69 70 |
# File 'lib/adsl/fol/first_order_logic.rb', line 68 def initialize(*objs) @objs = objs.flatten end |
Instance Attribute Details
#objs ⇒ Object (readonly)
Returns the value of attribute objs.
66 67 68 |
# File 'lib/adsl/fol/first_order_logic.rb', line 66 def objs @objs end |
Instance Method Details
#resolve_spass ⇒ Object
72 73 74 75 76 77 78 79 80 |
# File 'lib/adsl/fol/first_order_logic.rb', line 72 def resolve_spass children = @objs.map{ |child| child.resolve_spass } children = children.map{ |child| child.match('\Aand\((.*)\)\z') ? $1.split_by_zero_level_comma : child }.flatten children.delete_if{ |a| a == 'true' } return 'false' if children.include? 'false' return 'true' if children.empty? return children.first if children.length == 1 return "and(#{children.join(', ')})" end |