Class: Rivet::BaseConfig
- Defined in:
- lib/rivet/common/base_config.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#bootstrap ⇒ Object
Returns the value of attribute bootstrap.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from OpenState
#generated_attributes, #required_fields
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, load_path = '.', &block) ⇒ BaseConfig
constructor
A new instance of BaseConfig.
- #normalize_security_groups ⇒ Object
- #path(*args) ⇒ Object
- #post(&block) ⇒ Object
Methods inherited from OpenState
#install_get_or_set, #method_missing, #validate
Constructor Details
#initialize(name, load_path = '.', &block) ⇒ BaseConfig
Returns a new instance of BaseConfig.
14 15 16 17 18 19 20 |
# File 'lib/rivet/common/base_config.rb', line 14 def initialize(name, load_path='.', &block) super() @name = name @path = load_path @bootstrap = OpenState.new instance_eval(&block) if block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Rivet::OpenState
Instance Attribute Details
#bootstrap ⇒ Object
Returns the value of attribute bootstrap.
6 7 8 |
# File 'lib/rivet/common/base_config.rb', line 6 def bootstrap @bootstrap end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/rivet/common/base_config.rb', line 5 def name @name end |
Class Method Details
.from_file(dsl_file, load_path = '.') ⇒ Object
8 9 10 11 12 |
# File 'lib/rivet/common/base_config.rb', line 8 def self.from_file(dsl_file, load_path='.') name = File.basename(dsl_file, '.rb') data = Proc.new { eval(File.read(dsl_file)) } new(name, load_path, &data) end |
Instance Method Details
#normalize_security_groups ⇒ Object
35 36 37 |
# File 'lib/rivet/common/base_config.rb', line 35 def normalize_security_groups security_groups.sort end |
#path(*args) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/rivet/common/base_config.rb', line 22 def path(*args) if args.size < 1 @path else File.join(@path, *args) end end |
#post(&block) ⇒ Object
30 31 32 33 |
# File 'lib/rivet/common/base_config.rb', line 30 def post(&block) return @block if block.nil? @block = block end |