Class: Hiptest::Nodes::Item

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

Direct Known Subclasses

Actionword, LibraryActionword, 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.



296
297
298
299
300
301
302
303
304
305
# File 'lib/hiptest-publisher/nodes.rb', line 296

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.



294
295
296
# File 'lib/hiptest-publisher/nodes.rb', line 294

def non_valued_parameters
  @non_valued_parameters
end

#valued_parametersObject (readonly)

Returns the value of attribute valued_parameters.



294
295
296
# File 'lib/hiptest-publisher/nodes.rb', line 294

def valued_parameters
  @valued_parameters
end

#variablesObject (readonly)

Returns the value of attribute variables.



294
295
296
# File 'lib/hiptest-publisher/nodes.rb', line 294

def variables
  @variables
end

Instance Method Details

#add_tags(tags) ⇒ Object



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

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



307
308
309
310
311
312
313
# File 'lib/hiptest-publisher/nodes.rb', line 307

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