Class: Inspec::Object::List

Inherits:
Value
  • Object
show all
Defined in:
lib/inspec/objects/list.rb

Direct Known Subclasses

EachLoop

Instance Attribute Summary

Attributes inherited from Value

#qualifier, #skip, #variable

Instance Method Summary collapse

Methods inherited from Value

#initialize, #name_variable, #to_ruby

Methods included from RubyHelper

#ruby_qualifier

Constructor Details

This class inherits a constructor from Inspec::Object::Value

Instance Method Details

#map {|t| ... } ⇒ Object

Yields:

  • (t)


3
4
5
6
7
8
9
10
11
12
13
# File 'lib/inspec/objects/list.rb', line 3

def map
  raise "Inspec::Object::List.map needs to be called with a block" unless block_given?

  t = List.new
  t.qualifier = [["x"]]
  yield(t)
  return if t.qualifier == [["x"]]

  @qualifier.push(["map", "{ |x| #{t.to_ruby} }"])
  self
end