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
75 76 77 |
# File 'lib/bel/parse_objects.rb', line 75 def annotations @annotations end |
#comment ⇒ Object
Returns the value of attribute comment
75 76 77 |
# File 'lib/bel/parse_objects.rb', line 75 def comment @comment end |
#object ⇒ Object
Returns the value of attribute object
75 76 77 |
# File 'lib/bel/parse_objects.rb', line 75 def object @object end |
#rel ⇒ Object
Returns the value of attribute rel
75 76 77 |
# File 'lib/bel/parse_objects.rb', line 75 def rel @rel end |
#subject ⇒ Object
Returns the value of attribute subject
75 76 77 |
# File 'lib/bel/parse_objects.rb', line 75 def subject @subject end |
Instance Method Details
#nested? ⇒ Boolean
82 83 84 |
# File 'lib/bel/parse_objects.rb', line 82 def nested? object.is_a? Statement end |
#simple? ⇒ Boolean
79 80 81 |
# File 'lib/bel/parse_objects.rb', line 79 def simple? object.is_a? Term end |
#subject_only? ⇒ Boolean
76 77 78 |
# File 'lib/bel/parse_objects.rb', line 76 def subject_only? !rel end |
#to_s ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/bel/parse_objects.rb', line 85 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 |