Class: ChatworkTo::Config
- Inherits:
-
Object
- Object
- ChatworkTo::Config
- Defined in:
- lib/chatwork_to/config.rb
Instance Attribute Summary collapse
-
#chatwork_email ⇒ Object
readonly
Returns the value of attribute chatwork_email.
-
#chatwork_pass ⇒ Object
readonly
Returns the value of attribute chatwork_pass.
-
#notifiers ⇒ Object
readonly
Returns the value of attribute notifiers.
-
#rooms ⇒ Object
readonly
Returns the value of attribute rooms.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(opts) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(opts) ⇒ Config
Returns a new instance of Config.
5 6 7 8 9 10 11 |
# File 'lib/chatwork_to/config.rb', line 5 def initialize(opts) (opts) @chatwork_email = opts['chatwork']['email'] @chatwork_pass = opts['chatwork']['pass'] @rooms = Array[*opts['chatwork']['rooms']].map(&:to_s) @notifiers = Array[*opts['notifiers']] end |
Instance Attribute Details
#chatwork_email ⇒ Object (readonly)
Returns the value of attribute chatwork_email.
3 4 5 |
# File 'lib/chatwork_to/config.rb', line 3 def chatwork_email @chatwork_email end |
#chatwork_pass ⇒ Object (readonly)
Returns the value of attribute chatwork_pass.
3 4 5 |
# File 'lib/chatwork_to/config.rb', line 3 def chatwork_pass @chatwork_pass end |
#notifiers ⇒ Object (readonly)
Returns the value of attribute notifiers.
3 4 5 |
# File 'lib/chatwork_to/config.rb', line 3 def notifiers @notifiers end |
#rooms ⇒ Object (readonly)
Returns the value of attribute rooms.
3 4 5 |
# File 'lib/chatwork_to/config.rb', line 3 def rooms @rooms end |
Class Method Details
.load(opts = {}) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/chatwork_to/config.rb', line 23 def load(opts = {}) conf_hash = load_yaml(opts) if conf_hash.present? new(conf_hash) else raise InvalidConfiguration, 'Nothing configuration' end end |