class Cucumber::CucumberExpressions::Node
def end
def end @end end
def initialize(type, nodes, token, start, _end)
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
def nodes
def nodes @nodes end
def start
def start @start end
def text
def text if @token.nil? return @nodes.map { |value| value.text }.join('') end @token end
def to_hash
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
def token
def token @token end
def type
def type @type end