Class: Aker::Confident::Configuration
- Inherits:
-
Object
- Object
- Aker::Confident::Configuration
- Defined in:
- lib/aker/confident/configuration.rb
Instance Attribute Summary collapse
-
#agreement ⇒ Object
Returns the value of attribute agreement.
-
#host_hook ⇒ Object
Returns the value of attribute host_hook.
-
#pass_through_hooks ⇒ Object
readonly
Returns the value of attribute pass_through_hooks.
-
#root_url ⇒ Object
Returns the value of attribute root_url.
Instance Method Summary collapse
- #conf_file(file_name) ⇒ Object
- #conf_host_hook(callable) ⇒ Object
- #conf_model(model_name) ⇒ Object
- #define(&block) ⇒ Object
-
#initialize(options_hash = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #model ⇒ Object
- #set_url(url) ⇒ Object
- #verify! ⇒ Object
Constructor Details
#initialize(options_hash = {}) ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 14 15 16 17 |
# File 'lib/aker/confident/configuration.rb', line 9 def initialize(={}) @pass_through_hooks = [] conf_model([:conf_model]) conf_file([:conf_file]) set_url [:root_url] if [:conf_host_hook] conf_host_hook [:conf_host_hook] end end |
Instance Attribute Details
#agreement ⇒ Object
Returns the value of attribute agreement.
7 8 9 |
# File 'lib/aker/confident/configuration.rb', line 7 def agreement @agreement end |
#host_hook ⇒ Object
Returns the value of attribute host_hook.
7 8 9 |
# File 'lib/aker/confident/configuration.rb', line 7 def host_hook @host_hook end |
#pass_through_hooks ⇒ Object (readonly)
Returns the value of attribute pass_through_hooks.
8 9 10 |
# File 'lib/aker/confident/configuration.rb', line 8 def pass_through_hooks @pass_through_hooks end |
#root_url ⇒ Object
Returns the value of attribute root_url.
7 8 9 |
# File 'lib/aker/confident/configuration.rb', line 7 def root_url @root_url end |
Instance Method Details
#conf_file(file_name) ⇒ Object
36 37 38 |
# File 'lib/aker/confident/configuration.rb', line 36 def conf_file(file_name) @agreement_file = file_name end |
#conf_host_hook(callable) ⇒ Object
40 41 42 |
# File 'lib/aker/confident/configuration.rb', line 40 def conf_host_hook(callable) @pass_through_hooks << callable end |
#conf_model(model_name) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/aker/confident/configuration.rb', line 24 def conf_model(model_name) if model_name == :default @model = Confident::DefaultSignature else @model = model_name end end |
#define(&block) ⇒ Object
19 20 21 22 |
# File 'lib/aker/confident/configuration.rb', line 19 def define &block instance_eval &block self end |
#model ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/aker/confident/configuration.rb', line 55 def model if @model.is_a? String @model.constantize else @model end end |
#set_url(url) ⇒ Object
32 33 34 |
# File 'lib/aker/confident/configuration.rb', line 32 def set_url(url) @root_url = url end |
#verify! ⇒ Object
44 45 46 47 48 49 |
# File 'lib/aker/confident/configuration.rb', line 44 def verify! validate_agreement_file! load_agreement_file validate_hook! validate_model! end |