Class: Hako::Application
- Inherits:
-
Object
- Object
- Hako::Application
- Defined in:
- lib/hako/application.rb
Instance Attribute Summary collapse
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
- #id ⇒ String readonly
- #root_path ⇒ Pathname readonly
Instance Method Summary collapse
-
#initialize(definition_path, expand_variables: true, ask_keys: false) ⇒ Application
constructor
A new instance of Application.
Constructor Details
#initialize(definition_path, expand_variables: true, ask_keys: false) ⇒ Application
Returns a new instance of Application.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/hako/application.rb', line 18 def initialize(definition_path, expand_variables: true, ask_keys: false) path = Pathname.new(definition_path) @id = path.basename.sub_ext('').to_s @root_path = path.parent @definition = case path.extname when '.yml', '.yaml' YamlLoader.new.load(path) when '.jsonnet', '.json' JsonnetLoader.new(self, expand_variables: , ask_keys: ask_keys).load(path) else raise Error.new("Unknown extension: #{path}") end end |
Instance Attribute Details
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
16 |
# File 'lib/hako/application.rb', line 16 attr_reader :id, :root_path, :definition |
#id ⇒ String (readonly)
16 17 18 |
# File 'lib/hako/application.rb', line 16 def id @id end |
#root_path ⇒ Pathname (readonly)
16 |
# File 'lib/hako/application.rb', line 16 attr_reader :id, :root_path, :definition |