Class: Pieces::Config

Inherits:
Hash
  • Object
show all
Defined in:
lib/pieces/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Config

Returns a new instance of Config.



9
10
11
12
# File 'lib/pieces/config.rb', line 9

def initialize(config = {})
  @path = config[:path] || Dir.pwd
  load_config! unless config[:load] == false
end

Instance Attribute Details

#envObject

Returns the value of attribute env.



7
8
9
# File 'lib/pieces/config.rb', line 7

def env
  @env
end

#pathObject (readonly)

Returns the value of attribute path.



6
7
8
# File 'lib/pieces/config.rb', line 6

def path
  @path
end

Instance Method Details

#asset_prefixObject



34
35
36
# File 'lib/pieces/config.rb', line 34

def asset_prefix
  self['_asset_prefix']
end

#force_polling?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/pieces/config.rb', line 30

def force_polling?
  self['_force_polling']
end

#globalsObject



18
19
20
# File 'lib/pieces/config.rb', line 18

def globals
  self['_global'] || {}
end

#publish_endpointObject



22
23
24
25
26
27
28
# File 'lib/pieces/config.rb', line 22

def publish_endpoint
  if has_key?('_publish')
    self['_publish'].first
  else
    raise PublisherConfigNotFound
  end
end

#reload!Object



38
39
40
# File 'lib/pieces/config.rb', line 38

def reload!
  load_config!
end

#routesObject



14
15
16
# File 'lib/pieces/config.rb', line 14

def routes
  reject { |key, _| key =~ /^_/ }
end