Class: Ruleby::GeneratedTag
- Inherits:
-
Object
- Object
- Ruleby::GeneratedTag
- Defined in:
- lib/rulebook.rb
Constant Summary collapse
- @@tag_counter =
this counter is incremented for each UniqueTag created, and is appended to the end of the unique_seed in order to create a string that is unique for each instance of this class.
0- @@unique_seed =
every generated tag will be prefixed with this string
'unique_seed'
Instance Attribute Summary collapse
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
-
#tag_counter ⇒ Object
readonly
Returns the value of attribute tag_counter.
-
#unique_seed ⇒ Object
readonly
Returns the value of attribute unique_seed.
Instance Method Summary collapse
- #==(ut) ⇒ Object
-
#initialize ⇒ GeneratedTag
constructor
A new instance of GeneratedTag.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ GeneratedTag
Returns a new instance of GeneratedTag.
107 108 109 110 |
# File 'lib/rulebook.rb', line 107 def initialize() @@tag_counter += 1 @tag = @@unique_seed + @@tag_counter.to_s end |
Instance Attribute Details
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
114 115 116 |
# File 'lib/rulebook.rb', line 114 def tag @tag end |
#tag_counter ⇒ Object (readonly)
Returns the value of attribute tag_counter.
112 113 114 |
# File 'lib/rulebook.rb', line 112 def tag_counter @tag_counter end |
#unique_seed ⇒ Object (readonly)
Returns the value of attribute unique_seed.
113 114 115 |
# File 'lib/rulebook.rb', line 113 def unique_seed @unique_seed end |
Instance Method Details
#==(ut) ⇒ Object
116 117 118 |
# File 'lib/rulebook.rb', line 116 def ==(ut) return ut && ut.kind_of?(GeneratedTag) && @tag == ut.tag end |
#to_s ⇒ Object
120 121 122 |
# File 'lib/rulebook.rb', line 120 def to_s return @tag.to_s end |