Class: Gom::Remote::Subscription
- Inherits:
-
Object
- Object
- Gom::Remote::Subscription
- Defined in:
- lib/gom/remote/subscription.rb
Constant Summary collapse
- Defaults =
{ :name => nil, :operations => [:update], :condition_script => nil, :uri_regexp => nil, :callback => nil, }
Instance Attribute Summary collapse
-
#callback ⇒ Object
Returns the value of attribute callback.
-
#condition_script ⇒ Object
readonly
Returns the value of attribute condition_script.
-
#entry_uri ⇒ Object
readonly
Returns the value of attribute entry_uri.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#operations ⇒ Object
readonly
Returns the value of attribute operations.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
-
#uri_regexp ⇒ Object
readonly
Returns the value of attribute uri_regexp.
Instance Method Summary collapse
-
#initialize(entry_uri, options = {}, &blk) ⇒ Subscription
constructor
hint: supplying a recognizable name helps with distributed gom operations.
- #to_s ⇒ Object
Constructor Details
#initialize(entry_uri, options = {}, &blk) ⇒ Subscription
hint: supplying a recognizable name helps with distributed gom operations
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/gom/remote/subscription.rb', line 24 def initialize entry_uri, = {}, &blk @name = [:name] || "0x#{object_id}" # URI for the observer node @uri = "/gom/observer#{entry_uri.sub ':', '/'}/.#{@name}" @options = Defaults.merge @entry_uri = entry_uri @callback = [:callback] || blk; @operations = (@options[:operations] || []).join ', ' @uri_regexp = (re = @options[:uri_regexp]) && (Regexp.new re) || nil @condition_script = @options[:condition_script] end |
Instance Attribute Details
#callback ⇒ Object
Returns the value of attribute callback.
13 14 15 |
# File 'lib/gom/remote/subscription.rb', line 13 def callback @callback end |
#condition_script ⇒ Object (readonly)
Returns the value of attribute condition_script.
15 16 17 |
# File 'lib/gom/remote/subscription.rb', line 15 def condition_script @condition_script end |
#entry_uri ⇒ Object (readonly)
Returns the value of attribute entry_uri.
13 14 15 |
# File 'lib/gom/remote/subscription.rb', line 13 def entry_uri @entry_uri end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
15 16 17 |
# File 'lib/gom/remote/subscription.rb', line 15 def name @name end |
#operations ⇒ Object (readonly)
Returns the value of attribute operations.
15 16 17 |
# File 'lib/gom/remote/subscription.rb', line 15 def operations @operations end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
13 14 15 |
# File 'lib/gom/remote/subscription.rb', line 13 def uri @uri end |
#uri_regexp ⇒ Object (readonly)
Returns the value of attribute uri_regexp.
15 16 17 |
# File 'lib/gom/remote/subscription.rb', line 15 def uri_regexp @uri_regexp end |
Instance Method Details
#to_s ⇒ Object
17 18 19 |
# File 'lib/gom/remote/subscription.rb', line 17 def to_s "#{self.class}: #{@options.inject}" end |