Class: Hiptest::Nodes::Item

Inherits:
Node
  • Object
show all
Defined in:
lib/hiptest-publisher/nodes.rb

Direct Known Subclasses

Actionword, Scenario

Instance Attribute Summary collapse

Attributes inherited from Node

#children, #parent

Instance Method Summary collapse

Methods inherited from Node

#==, #each_direct_children, #each_sub_nodes, #flat_string, #kind, #pretty_print_instance_variables, #project, #render

Constructor Details

#initialize(name, tags = [], description = '', parameters = [], body = []) ⇒ Item

Returns a new instance of Item.



316
317
318
319
320
321
322
323
324
325
# File 'lib/hiptest-publisher/nodes.rb', line 316

def initialize(name, tags = [], description = '', parameters = [], body = [])
  super()
  @children = {
    name: name,
    tags: tags,
    description: description,
    parameters: parameters,
    body: body
  }
end

Instance Attribute Details

#non_valued_parametersObject (readonly)

Returns the value of attribute non_valued_parameters.



314
315
316
# File 'lib/hiptest-publisher/nodes.rb', line 314

def non_valued_parameters
  @non_valued_parameters
end

#valued_parametersObject (readonly)

Returns the value of attribute valued_parameters.



314
315
316
# File 'lib/hiptest-publisher/nodes.rb', line 314

def valued_parameters
  @valued_parameters
end

#variablesObject (readonly)

Returns the value of attribute variables.



314
315
316
# File 'lib/hiptest-publisher/nodes.rb', line 314

def variables
  @variables
end

Instance Method Details

#add_tags(tags) ⇒ Object



335
336
337
338
339
340
341
342
343
344
# File 'lib/hiptest-publisher/nodes.rb', line 335

def add_tags(tags)
  existing = @children[:tags].map(&:to_s)

  tags.each do |tag|
    next if existing.include? tag.to_s

    existing << tag.to_s
    @children[:tags] << tag
  end
end

#declared_variables_namesObject



327
328
329
330
331
332
333
# File 'lib/hiptest-publisher/nodes.rb', line 327

def declared_variables_names
  p_names = children[:parameters].map {|p| p.children[:name]}
  each_sub_nodes(Hiptest::Nodes::Variable).map do |var|
    v_name = var.children[:name]
    p_names.include?(v_name) ? nil : v_name
  end.uniq.compact
end