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.
| 3 4 5 | # File 'lib/eco/assets.rb', line 3 def active_config @active_config end | 
Instance Method Details
#cli(&block) ⇒ Object
| 35 36 37 38 39 40 41 42 | # File 'lib/eco/assets.rb', line 35 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
| 17 18 19 20 21 22 23 24 25 26 27 28 29 | # File 'lib/eco/assets.rb', line 17 def config(key: active_config, update_active: true) configs[:default] ||= Eco::API::Session::Config.new(key) unless configs.key?(key) @active_config = key if 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
| 31 32 33 | # File 'lib/eco/assets.rb', line 31 def configs @configs ||= {} end | 
#session(key: active_config, update_active: true) ⇒ Object
| 11 12 13 14 15 | # File 'lib/eco/assets.rb', line 11 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 |