Module: ThePlatform::Configuration

Extended by:
Configuration
Included in:
Configuration, Data, Identity
Defined in:
lib/theplatform/configuration.rb

Overview

Module to extend to other Classes in order to set up #configuration on a per object basis

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#_durationObject

Returns the value of attribute _duration.



8
9
10
# File 'lib/theplatform/configuration.rb', line 8

def _duration
  @_duration
end

#_idleTimeoutObject

Returns the value of attribute _idleTimeout.



8
9
10
# File 'lib/theplatform/configuration.rb', line 8

def _idleTimeout
  @_idleTimeout
end

#formObject

Returns the value of attribute form.



8
9
10
# File 'lib/theplatform/configuration.rb', line 8

def form
  @form
end

#passwordObject

Returns the value of attribute password.



8
9
10
# File 'lib/theplatform/configuration.rb', line 8

def password
  @password
end

#schemaObject

Returns the value of attribute schema.



8
9
10
# File 'lib/theplatform/configuration.rb', line 8

def schema
  @schema
end

#tokenObject

Returns the value of attribute token.



8
9
10
# File 'lib/theplatform/configuration.rb', line 8

def token
  @token
end

#usernameObject

Returns the value of attribute username.



8
9
10
# File 'lib/theplatform/configuration.rb', line 8

def username
  @username
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Allows for a Rails type configuration setup. Different object make different configurations.

ThePlatform::Data.configure do |config|
  config.schema = '1.4.0'
  config.form = 'cjson'
  config.token = 'o4VThP--IcaKwltckmgdw544KD0kKDg'
end
=>  {:schema=>"1.4.0", :form=>"json", :token=>"o4VThP--IcaKwltckmgdw544KD0kKDg"}

Yields:

  • (_self)

Yield Parameters:



19
20
21
22
# File 'lib/theplatform/configuration.rb', line 19

def configure
  yield self
  parameters
end

#parametersObject

List available parameters and values in those params



25
26
27
28
29
# File 'lib/theplatform/configuration.rb', line 25

def parameters
  @values = {}
  keys.each { |k| @values.merge! k => get_var(k) unless get_var(k) == nil }
  @values
end

#parameters?Boolean

Returns true or false if all parameters are set.

Returns:

  • (Boolean)


32
33
34
# File 'lib/theplatform/configuration.rb', line 32

def parameters?
  parameters.keys == keys
end