Class: Fig::Configuration
- Inherits:
-
Object
- Object
- Fig::Configuration
- Defined in:
- lib/fig/package.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#statements ⇒ Object
readonly
Returns the value of attribute statements.
Instance Method Summary collapse
- #commands ⇒ Object
-
#initialize(name, statements) ⇒ Configuration
constructor
A new instance of Configuration.
- #unparse(indent) ⇒ Object
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
#name ⇒ Object (readonly)
Returns the value of attribute name.
114 115 116 |
# File 'lib/fig/package.rb', line 114 def name @name end |
#statements ⇒ Object (readonly)
Returns the value of attribute statements.
114 115 116 |
# File 'lib/fig/package.rb', line 114 def statements @statements end |
Instance Method Details
#commands ⇒ Object
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 |