Class: Fig::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/fig/package.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, statements) ⇒ Configuration

Returns a new instance of Configuration.



116
117
118
119
# File 'lib/fig/package.rb', line 116

def initialize(name, statements)
  @name = name
  @statements = statements
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



114
115
116
# File 'lib/fig/package.rb', line 114

def name
  @name
end

#statementsObject (readonly)

Returns the value of attribute statements.



114
115
116
# File 'lib/fig/package.rb', line 114

def statements
  @statements
end

Instance Method Details

#commandsObject



121
122
123
124
125
126
127
# File 'lib/fig/package.rb', line 121

def commands
  result = statements.select { |statement| statement.is_a?(Command) }
#      if result.empty?
#        raise "No commands found for config: #{@name}"
#      end
  result
end

#unparse(indent) ⇒ Object



129
130
131
# File 'lib/fig/package.rb', line 129

def unparse(indent)
  unparse_statements(indent, "config #{@name}", @statements, "end")
end