Class: Cucumber::CucumberExpressions::Node
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/ast.rb
Instance Method Summary collapse
- #end ⇒ Object
-
#initialize(type, nodes, token, start, _end) ⇒ Node
constructor
A new instance of Node.
- #nodes ⇒ Object
- #start ⇒ Object
- #text ⇒ Object
- #to_hash ⇒ Object
- #token ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(type, nodes, token, start, _end) ⇒ Node
Returns a new instance of Node.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/ast.rb', line 11 def initialize(type, nodes, token, start, _end) if nodes.nil? && token.nil? raise 'Either nodes or token must be defined' end @type = type @nodes = nodes @token = token @start = start @end = _end end |
Instance Method Details
#end ⇒ Object
38 39 40 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/ast.rb', line 38 def end @end end |
#nodes ⇒ Object
26 27 28 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/ast.rb', line 26 def nodes @nodes end |
#start ⇒ Object
34 35 36 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/ast.rb', line 34 def start @start end |
#text ⇒ Object
42 43 44 45 46 47 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/ast.rb', line 42 def text if @token.nil? return @nodes.map { |value| value.text }.join('') end @token end |
#to_hash ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/ast.rb', line 49 def to_hash hash = Hash.new hash["type"] = @type unless @nodes.nil? hash["nodes"] = @nodes.map { |node| node.to_hash } end unless @token.nil? hash["token"] = @token end hash["start"] = @start hash["end"] = @end hash end |
#token ⇒ Object
30 31 32 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/ast.rb', line 30 def token @token end |
#type ⇒ Object
22 23 24 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/ast.rb', line 22 def type @type end |