Class: Riddl::Utils::Notifications::Producer::Backend
- Inherits:
-
Object
- Object
- Riddl::Utils::Notifications::Producer::Backend
- Defined in:
- lib/ruby/riddl/utils/notifications_producer.rb
Overview
}}}
Defined Under Namespace
Instance Attribute Summary collapse
-
#topics ⇒ Object
readonly
{{{.
Instance Method Summary collapse
-
#initialize(topics, target, init = nil) ⇒ Backend
constructor
}}}.
- #subscriptions ⇒ Object
Constructor Details
#initialize(topics, target, init = nil) ⇒ Backend
}}}
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/ruby/riddl/utils/notifications_producer.rb', line 133 def initialize(topics,target,init=nil) @target = target.gsub(/^\/+/,'/') unless File.exists?(@target) if init FileUtils::cp_r init, @target else FileUtils::mkdir_p(@target) end end raise "topics file not found" unless File.exists?(topics) @topics = XML::Smart.open_unprotected(topics.gsub(/^\/+/,'/')) @topics.register_namespace 'n', 'http://riddl.org/ns/common-patterns/notifications-producer/1.0' subscriptions.each do |sub,key| sub.read do |doc| if doc.find('/*[@url]').empty? sub.delete end end end end |
Instance Attribute Details
#topics ⇒ Object (readonly)
{{{
56 57 58 |
# File 'lib/ruby/riddl/utils/notifications_producer.rb', line 56 def topics @topics end |