Class: Statement::Stment

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

Overview

source s_name { .. };

Instance Method Summary collapse

Constructor Details

#initialize(type, id, options = []) ⇒ Stment

Returns a new instance of Stment.



5
6
7
8
9
# File 'lib/puppet/parser/functions/statement.rb', line 5

def initialize(type, id, options=[])
    @type = type
    @id = id
    @options = options
end

Instance Method Details

#add_option(option) ⇒ Object



11
12
13
# File 'lib/puppet/parser/functions/statement.rb', line 11

def add_option(option)
    @options << option
end

#buildObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/puppet/parser/functions/statement.rb', line 15

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

    built_options = @options.map {|item| item.build}

    Statement.decrease_indent
    tail = Statement.getln("};")
    return header + built_options.join('') + tail
end