Module: Shapeable

Defined in:
lib/shapeable.rb,
lib/shapeable/shape.rb,
lib/shapeable/errors.rb,
lib/shapeable/version.rb,
lib/shapeable/extenders.rb,
lib/shapeable/configuration.rb

Defined Under Namespace

Modules: Errors, Extenders, Shape Classes: Configuration

Constant Summary collapse

CONFIG_FILE =
'./config/shapeable.rb'
VERSION =
'0.7.1'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configuration_dataObject

Returns the value of attribute configuration_data.



11
12
13
# File 'lib/shapeable.rb', line 11

def configuration_data
  @configuration_data
end

Class Method Details

.configurationObject



27
28
29
# File 'lib/shapeable.rb', line 27

def configuration
  self.configuration_data ||= Shapeable::Configuration.new
end

.configure(file = nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/shapeable.rb', line 13

def configure(file = nil)
  configuration
  if block_given?
    yield(configuration)
  else
    if File.exists?(CONFIG_FILE)
      file ||= CONFIG_FILE
      require file
    else
      raise ArgumentError, "Configure requires a block or the existance of a #{CONFIG_FILE} in your project"
    end
  end
end