Class: Fdlint::Parser::JS::Element
- Defined in:
- lib/fdlint/parser/js/struct.rb
Direct Known Subclasses
Expression, ForConditionElement, FunctionDeclaraion, Program, Statement
Instance Attribute Summary collapse
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #contains?(target) ⇒ Boolean
-
#initialize(type, left = nil, right = nil, position = nil) ⇒ Element
constructor
A new instance of Element.
- #position ⇒ Object
- #text ⇒ Object
Constructor Details
#initialize(type, left = nil, right = nil, position = nil) ⇒ Element
Returns a new instance of Element.
14 15 16 |
# File 'lib/fdlint/parser/js/struct.rb', line 14 def initialize(type, left = nil, right = nil, position = nil) @type, @left, @right, @position = type, left, right, position end |
Instance Attribute Details
#left ⇒ Object (readonly)
Returns the value of attribute left.
12 13 14 |
# File 'lib/fdlint/parser/js/struct.rb', line 12 def left @left end |
#right ⇒ Object (readonly)
Returns the value of attribute right.
12 13 14 |
# File 'lib/fdlint/parser/js/struct.rb', line 12 def right @right end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
12 13 14 |
# File 'lib/fdlint/parser/js/struct.rb', line 12 def type @type end |
Instance Method Details
#contains?(target) ⇒ Boolean
28 29 30 31 32 |
# File 'lib/fdlint/parser/js/struct.rb', line 28 def contains?(target) return true if target == @type left && left.respond_to?(:contains?) && left.contains?(target) or right && right.respond_to?(:contains?) && right.contains?(target) end |
#position ⇒ Object
22 23 24 25 26 |
# File 'lib/fdlint/parser/js/struct.rb', line 22 def position @position ? @position : left ? left.position : right ? right.position : nil end |
#text ⇒ Object
18 19 20 |
# File 'lib/fdlint/parser/js/struct.rb', line 18 def text "(#{type},#{left},#{right})" end |