Class: Modulofcm::Configurator
- Inherits:
-
Object
- Object
- Modulofcm::Configurator
- Defined in:
- lib/modulofcm/configurator.rb
Instance Attribute Summary collapse
-
#clients ⇒ Object
readonly
Returns the value of attribute clients.
Class Method Summary collapse
Instance Method Summary collapse
- #client(name) {|client| ... } ⇒ Object
-
#initialize ⇒ Configurator
constructor
A new instance of Configurator.
Constructor Details
#initialize ⇒ Configurator
Returns a new instance of Configurator.
9 10 11 |
# File 'lib/modulofcm/configurator.rb', line 9 def initialize @clients = {} end |
Instance Attribute Details
#clients ⇒ Object (readonly)
Returns the value of attribute clients.
7 8 9 |
# File 'lib/modulofcm/configurator.rb', line 7 def clients @clients end |
Class Method Details
Instance Method Details
#client(name) {|client| ... } ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/modulofcm/configurator.rb', line 22 def client(name) raise ArgumentError, 'A block is needed for Modulofcm::Configurator.client' unless block_given? client = Client.new(name: name) yield client validated_client, errors = validate_client(client) raise InvalidClient, errors.join('; ') unless validated_client @clients[name] = client end |