Class: SimpleFeed::Providers::Key
- Inherits:
-
Object
- Object
- SimpleFeed::Providers::Key
- Defined in:
- lib/simplefeed/providers/key.rb
Overview
Here is a meta key for a given user ID:
user 'm' for meta
↓ ↓
"ff|u.f23098.m"
↑ ↑
namespace consumer(base62)
Constant Summary collapse
- SERIALIZED_DATA_TEMPLATE =
'{{namespace}}u.{{data_id}}.d'
- SERIALIZED_META_TEMPLATE =
'{{namespace}}u.{{meta_id}}.m'
Instance Attribute Summary collapse
-
#consumer ⇒ Object
readonly
Returns the value of attribute consumer.
-
#data_key_transformer ⇒ Object
readonly
Returns the value of attribute data_key_transformer.
-
#meta_key_transformer ⇒ Object
readonly
Returns the value of attribute meta_key_transformer.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
Class Method Summary collapse
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(consumer, namespace: nil, data_key_transformer: nil, meta_key_transformer: nil) ⇒ Key
constructor
A new instance of Key.
- #inspect ⇒ Object
- #keys ⇒ Object
- #meta ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(consumer, namespace: nil, data_key_transformer: nil, meta_key_transformer: nil) ⇒ Key
Returns a new instance of Key.
29 30 31 32 33 34 35 36 37 |
# File 'lib/simplefeed/providers/key.rb', line 29 def initialize(consumer, namespace: nil, data_key_transformer: nil, meta_key_transformer: nil) @consumer = consumer @namespace = namespace @data_key_transformer = data_key_transformer @meta_key_transformer = end |
Instance Attribute Details
#consumer ⇒ Object (readonly)
Returns the value of attribute consumer.
27 28 29 |
# File 'lib/simplefeed/providers/key.rb', line 27 def consumer @consumer end |
#data_key_transformer ⇒ Object (readonly)
Returns the value of attribute data_key_transformer.
27 28 29 |
# File 'lib/simplefeed/providers/key.rb', line 27 def data_key_transformer @data_key_transformer end |
#meta_key_transformer ⇒ Object (readonly)
Returns the value of attribute meta_key_transformer.
27 28 29 |
# File 'lib/simplefeed/providers/key.rb', line 27 def @meta_key_transformer end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
27 28 29 |
# File 'lib/simplefeed/providers/key.rb', line 27 def namespace @namespace end |
Class Method Details
.rot13(value) ⇒ Object
18 19 20 21 |
# File 'lib/simplefeed/providers/key.rb', line 18 def rot13(value) value.tr('abcdefghijklmnopqrstuvwxyz', 'nopqrstuvwxyzabcdefghijklm') end |
Instance Method Details
#data ⇒ Object
39 40 41 |
# File 'lib/simplefeed/providers/key.rb', line 39 def data @data ||= render(SERIALIZED_DATA_TEMPLATE) end |
#inspect ⇒ Object
55 56 57 |
# File 'lib/simplefeed/providers/key.rb', line 55 def inspect super + key_params.inspect end |
#keys ⇒ Object
47 48 49 |
# File 'lib/simplefeed/providers/key.rb', line 47 def keys [data, ] end |
#meta ⇒ Object
43 44 45 |
# File 'lib/simplefeed/providers/key.rb', line 43 def @meta ||= render(SERIALIZED_META_TEMPLATE) end |
#to_s ⇒ Object
51 52 53 |
# File 'lib/simplefeed/providers/key.rb', line 51 def to_s super + key_params.to_s end |