Class: Notify::Registry
- Inherits:
-
Object
- Object
- Notify::Registry
- Defined in:
- lib/notify/registry.rb
Instance Attribute Summary collapse
-
#templates_path ⇒ Object
readonly
Returns the value of attribute templates_path.
Instance Method Summary collapse
- #adapters ⇒ Object
- #adapters_for(message_name) ⇒ Object
- #freeze! ⇒ Object
- #frozen? ⇒ Boolean
-
#initialize(templates_path) ⇒ Registry
constructor
A new instance of Registry.
- #message?(name) ⇒ Boolean
- #messages ⇒ Object
Constructor Details
#initialize(templates_path) ⇒ Registry
Returns a new instance of Registry.
10 11 12 13 14 |
# File 'lib/notify/registry.rb', line 10 def initialize(templates_path) @templates_path = Pathname(templates_path) @message_adapters = {} scan! if @templates_path.directory? end |
Instance Attribute Details
#templates_path ⇒ Object (readonly)
Returns the value of attribute templates_path.
8 9 10 |
# File 'lib/notify/registry.rb', line 8 def templates_path @templates_path end |
Instance Method Details
#adapters ⇒ Object
20 21 22 |
# File 'lib/notify/registry.rb', line 20 def adapters @adapters_view ||= build_adapters_view end |
#adapters_for(message_name) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/notify/registry.rb', line 28 def adapters_for() set = @message_adapters[.to_sym] return [].freeze unless set set.to_a.sort.freeze end |
#freeze! ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/notify/registry.rb', line 35 def freeze! @message_adapters.each_value(&:freeze) @message_adapters.freeze adapters self end |
#frozen? ⇒ Boolean
43 44 45 |
# File 'lib/notify/registry.rb', line 43 def frozen? @message_adapters.frozen? end |
#message?(name) ⇒ Boolean
24 25 26 |
# File 'lib/notify/registry.rb', line 24 def (name) @message_adapters.key?(name.to_sym) end |
#messages ⇒ Object
16 17 18 |
# File 'lib/notify/registry.rb', line 16 def @messages ||= end |