Class: BEL::Script::Statement
- Inherits:
-
Struct
- Object
- Struct
- BEL::Script::Statement
- Defined in:
- lib/bel/parse_objects.rb
Instance Attribute Summary collapse
-
#annotations ⇒ Object
Returns the value of attribute annotations.
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#object ⇒ Object
Returns the value of attribute object.
-
#rel ⇒ Object
Returns the value of attribute rel.
-
#subject ⇒ Object
Returns the value of attribute subject.
Instance Method Summary collapse
Instance Attribute Details
#annotations ⇒ Object
Returns the value of attribute annotations
74 75 76 |
# File 'lib/bel/parse_objects.rb', line 74 def annotations @annotations end |
#comment ⇒ Object
Returns the value of attribute comment
74 75 76 |
# File 'lib/bel/parse_objects.rb', line 74 def comment @comment end |
#object ⇒ Object
Returns the value of attribute object
74 75 76 |
# File 'lib/bel/parse_objects.rb', line 74 def object @object end |
#rel ⇒ Object
Returns the value of attribute rel
74 75 76 |
# File 'lib/bel/parse_objects.rb', line 74 def rel @rel end |
#subject ⇒ Object
Returns the value of attribute subject
74 75 76 |
# File 'lib/bel/parse_objects.rb', line 74 def subject @subject end |
Instance Method Details
#nested? ⇒ Boolean
81 82 83 |
# File 'lib/bel/parse_objects.rb', line 81 def nested? object.is_a? Statement end |
#simple? ⇒ Boolean
78 79 80 |
# File 'lib/bel/parse_objects.rb', line 78 def simple? object.is_a? Term end |
#subject_only? ⇒ Boolean
75 76 77 |
# File 'lib/bel/parse_objects.rb', line 75 def subject_only? !rel end |
#to_s ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/bel/parse_objects.rb', line 84 def to_s lbl = case when subject_only? subject.to_s when simple? "#{subject.to_s} #{rel} #{object.to_s}" when nested? "#{subject.to_s} #{rel} (#{object.to_s})" end comment ? lbl + ' //' + comment : lbl end |