Class: Longjing::PDDL::Obj
- Inherits:
-
Object
- Object
- Longjing::PDDL::Obj
- Defined in:
- lib/longjing/pddl/obj.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(name, type = nil) ⇒ Obj
constructor
A new instance of Obj.
- #inspect ⇒ Object
- #is_a?(type) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(name, type = nil) ⇒ Obj
Returns a new instance of Obj.
5 6 7 8 9 |
# File 'lib/longjing/pddl/obj.rb', line 5 def initialize(name, type=nil) @name = name @type = type || Type::OBJECT @hash = name.hash end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
4 5 6 |
# File 'lib/longjing/pddl/obj.rb', line 4 def hash @hash end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/longjing/pddl/obj.rb', line 4 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/longjing/pddl/obj.rb', line 4 def type @type end |
Instance Method Details
#inspect ⇒ Object
21 22 23 |
# File 'lib/longjing/pddl/obj.rb', line 21 def inspect "(object #{to_s})" end |
#is_a?(type) ⇒ Boolean
11 12 13 14 15 |
# File 'lib/longjing/pddl/obj.rb', line 11 def is_a?(type) t = @type t = t.parent until t == type || t.nil? !t.nil? end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/longjing/pddl/obj.rb', line 17 def to_s "#{@name} - #{@type}" end |