Class: Yap::Shell::Parser::Nodes::ArgumentNode
- Inherits:
-
Object
- Object
- Yap::Shell::Parser::Nodes::ArgumentNode
- Includes:
- Visitor
- Defined in:
- lib/yap/shell/parser/nodes.rb
Instance Attribute Summary collapse
-
#lvalue ⇒ Object
readonly
Returns the value of attribute lvalue.
Instance Method Summary collapse
- #double_quoted? ⇒ Boolean
- #escaped? ⇒ Boolean
-
#initialize(token) ⇒ ArgumentNode
constructor
A new instance of ArgumentNode.
- #inspect ⇒ Object
- #quoted? ⇒ Boolean
- #single_quoted? ⇒ Boolean
- #to_s ⇒ Object
Methods included from Visitor
Constructor Details
#initialize(token) ⇒ ArgumentNode
Returns a new instance of ArgumentNode.
22 23 24 25 |
# File 'lib/yap/shell/parser/nodes.rb', line 22 def initialize(token) @lvalue = token.value @attrs = token.attrs end |
Instance Attribute Details
#lvalue ⇒ Object (readonly)
Returns the value of attribute lvalue.
20 21 22 |
# File 'lib/yap/shell/parser/nodes.rb', line 20 def lvalue @lvalue end |
Instance Method Details
#double_quoted? ⇒ Boolean
35 36 37 |
# File 'lib/yap/shell/parser/nodes.rb', line 35 def double_quoted? @attrs[:quoted_by] == '"' end |
#escaped? ⇒ Boolean
27 28 29 |
# File 'lib/yap/shell/parser/nodes.rb', line 27 def escaped? @attrs[:escaped] end |
#inspect ⇒ Object
43 44 45 |
# File 'lib/yap/shell/parser/nodes.rb', line 43 def inspect to_s end |
#quoted? ⇒ Boolean
31 32 33 |
# File 'lib/yap/shell/parser/nodes.rb', line 31 def quoted? double_quoted? || single_quoted? end |
#single_quoted? ⇒ Boolean
39 40 41 |
# File 'lib/yap/shell/parser/nodes.rb', line 39 def single_quoted? @attrs[:quoted_by] == "'" end |
#to_s ⇒ Object
47 48 49 |
# File 'lib/yap/shell/parser/nodes.rb', line 47 def to_s "ArgumentNode(#{lvalue.inspect} escaped? #{escaped?} double_quoted? #{double_quoted?} single_quoted? #{single_quoted?})" end |