Class: Ruleby::GeneratedTag

Inherits:
Object
  • Object
show all
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. This isn’t full-proof.

'unique_seed'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGeneratedTag

Returns a new instance of GeneratedTag.



66
67
68
69
# File 'lib/rulebook.rb', line 66

def initialize()
  @@tag_counter += 1
  @tag = @@unique_seed + @@tag_counter.to_s
end

Instance Attribute Details

#tagObject (readonly)

Returns the value of attribute tag.



73
74
75
# File 'lib/rulebook.rb', line 73

def tag
  @tag
end

#tag_counterObject (readonly)

Returns the value of attribute tag_counter.



71
72
73
# File 'lib/rulebook.rb', line 71

def tag_counter
  @tag_counter
end

#unique_seedObject (readonly)

Returns the value of attribute unique_seed.



72
73
74
# File 'lib/rulebook.rb', line 72

def unique_seed
  @unique_seed
end

Instance Method Details

#==(ut) ⇒ Object



75
76
77
# File 'lib/rulebook.rb', line 75

def ==(ut)
  return ut && ut.kind_of?(GeneratedTag) && @tag == ut.tag
end

#to_sObject



79
80
81
# File 'lib/rulebook.rb', line 79

def to_s
  return @tag.to_s
end