Class: Eco::Assets
- Defined in:
- lib/eco/assets.rb,
lib/eco/assets/language.rb
Defined Under Namespace
Classes: Language
Instance Attribute Summary collapse
-
#active_config ⇒ Object
readonly
Returns the value of attribute active_config.
Instance Method Summary collapse
- #cli(&block) ⇒ Object
- #config(key: active_config, update_active: true) ⇒ Object
- #configs ⇒ Object
-
#initialize ⇒ Assets
constructor
A new instance of Assets.
- #session(key: active_config, update_active: true) ⇒ Object
Constructor Details
Instance Attribute Details
#active_config ⇒ Object (readonly)
Returns the value of attribute active_config.
4 5 6 |
# File 'lib/eco/assets.rb', line 4 def active_config @active_config end |
Instance Method Details
#cli(&block) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/eco/assets.rb', line 34 def cli(&block) unless @cli_init @cli_init = true require_relative('cli_default') end @cli.tap { yield(@cli) if block_given? } end |
#config(key: active_config, update_active: true) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/eco/assets.rb', line 18 def config(key: active_config, update_active: true) configs[:default] ||= Eco::API::Session::Config.new(key) unless configs.key?(key) @active_config = key unless !update_active configs[key] = configs[:default].clone(key) end configs[key].tap do |config| config.active_api(key) if config.apis.defined?(key) yield(config) if block_given? end end |
#configs ⇒ Object
30 31 32 |
# File 'lib/eco/assets.rb', line 30 def configs @configs ||= {} end |
#session(key: active_config, update_active: true) ⇒ Object
12 13 14 15 16 |
# File 'lib/eco/assets.rb', line 12 def session(key: active_config, update_active: true) config(key: key, update_active: update_active).session.tap do |session| yield(session) if block_given? end end |