Class: Statement::TypedParameter

Inherits:
Parameter show all
Defined in:
lib/puppet/parser/functions/statement.rb

Overview

like flags in a source

Instance Method Summary collapse

Constructor Details

#initialize(type = '') ⇒ TypedParameter

Returns a new instance of TypedParameter.



54
55
56
57
# File 'lib/puppet/parser/functions/statement.rb', line 54

def initialize(type='')
    @type = type
    @values = []
end

Instance Method Details

#add_value(value) ⇒ Object



63
64
65
# File 'lib/puppet/parser/functions/statement.rb', line 63

def add_value(value)
    @values << value
end

#buildObject



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/puppet/parser/functions/statement.rb', line 67

def build
    header = Statement.getln("#{@type}(")
    Statement.increase_indent

    built_values = @values.map {|item| item.build}

    Statement.decrease_indent
    tail = Statement.line(")")

    if @values.length >= 1
        return header + built_values.join(",\n") + "\n" +  tail
    else
        return header + tail
    end
end

#type=(type) ⇒ Object



59
60
61
# File 'lib/puppet/parser/functions/statement.rb', line 59

def type=(type)
    @type = type
end