Class: Piggly::Tags::AbstractTag
Direct Known Subclasses
Constant Summary collapse
- PATTERN =
/[0-9a-f]{16}/
Instance Attribute Summary collapse
-
#id ⇒ Object
(also: #to_s)
Returns the value of attribute id.
Instance Method Summary collapse
-
#initialize(prefix = nil, id = nil) ⇒ AbstractTag
constructor
A new instance of AbstractTag.
-
#tap {|_self| ... } ⇒ Object
Defined here in case ActiveSupport hasn’t defined it on Object.
Constructor Details
#initialize(prefix = nil, id = nil) ⇒ AbstractTag
Returns a new instance of AbstractTag.
18 19 20 |
# File 'lib/piggly/tags.rb', line 18 def initialize(prefix = nil, id = nil) @id = Digest::MD5.hexdigest(prefix.to_s + (id || object_id).to_s).slice(0, 16) end |
Instance Attribute Details
#id ⇒ Object Also known as: to_s
Returns the value of attribute id.
16 17 18 |
# File 'lib/piggly/tags.rb', line 16 def id @id end |
Instance Method Details
#tap {|_self| ... } ⇒ Object
Defined here in case ActiveSupport hasn’t defined it on Object
25 26 27 28 |
# File 'lib/piggly/tags.rb', line 25 def tap yield self self end |