class Riddl::Utils::Notifications::Producer::Backend::Sub

Public Class Methods

new(name) click to toggle source
# File lib/ruby/riddl/utils/notifications_producer.rb, line 59
def initialize(name)
  @name = name
end

Public Instance Methods

delete() click to toggle source
# File lib/ruby/riddl/utils/notifications_producer.rb, line 68
def delete
  FileUtils::rm_rf(File.dirname(@name))
end
modify(&block) click to toggle source
# File lib/ruby/riddl/utils/notifications_producer.rb, line 62
def modify(&block)
  XML::Smart.modify(@name,"<subscription xmlns='http://riddl.org/ns/common-patterns/notifications-producer/1.0'/>") do |doc|
    doc.register_namespace 'n', 'http://riddl.org/ns/common-patterns/notifications-producer/1.0'
    block.call doc
  end
end
read(&block) click to toggle source
# File lib/ruby/riddl/utils/notifications_producer.rb, line 74
def read(&block)
  XML::Smart.open_unprotected(@name) do |doc|
    doc.register_namespace 'n', 'http://riddl.org/ns/common-patterns/notifications-producer/1.0'
    block.call doc
  end
end
to_s() click to toggle source
# File lib/ruby/riddl/utils/notifications_producer.rb, line 71
def to_s
  File.read(@name)
end