Class: Nostr::Subscription
- Inherits:
-
Object
- Object
- Nostr::Subscription
- Defined in:
- lib/nostr/subscription.rb
Overview
A subscription the result of a request to receive events from a relay
Instance Attribute Summary collapse
-
#filter ⇒ Filter
readonly
An object that determines what events will be sent in the subscription.
-
#id ⇒ String
readonly
An arbitrary, non-empty string of max length 64 chars used to represent a subscription.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Compares two subscriptions.
-
#initialize(filter:, id: SecureRandom.hex) ⇒ Subscription
constructor
Initializes a subscription.
Constructor Details
#initialize(filter:, id: SecureRandom.hex) ⇒ Subscription
Initializes a subscription
47 48 49 50 |
# File 'lib/nostr/subscription.rb', line 47 def initialize(filter:, id: SecureRandom.hex) @id = id @filter = filter end |
Instance Attribute Details
#filter ⇒ Filter (readonly)
An object that determines what events will be sent in the subscription
29 30 31 |
# File 'lib/nostr/subscription.rb', line 29 def filter @filter end |
#id ⇒ String (readonly)
An arbitrary, non-empty string of max length 64 chars used to represent a subscription
17 18 19 |
# File 'lib/nostr/subscription.rb', line 17 def id @id end |
Instance Method Details
#==(other) ⇒ Boolean
Compares two subscriptions. Returns true if all attributes are equal and false otherwise
61 62 63 |
# File 'lib/nostr/subscription.rb', line 61 def ==(other) id == other.id && filter == other.filter end |