Class: GeoPattern::Seed
- Inherits:
-
Object
- Object
- GeoPattern::Seed
- Defined in:
- lib/geo_pattern/seed.rb
Instance Method Summary collapse
- #[](*args) ⇒ Object
-
#initialize(string) ⇒ Seed
constructor
A new instance of Seed.
- #to_i(index, length) ⇒ Object
Constructor Details
#initialize(string) ⇒ Seed
Returns a new instance of Seed.
9 10 11 |
# File 'lib/geo_pattern/seed.rb', line 9 def initialize(string) @seed = Digest::SHA1.hexdigest string.to_s end |
Instance Method Details
#[](*args) ⇒ Object
13 14 15 |
# File 'lib/geo_pattern/seed.rb', line 13 def [](*args) seed[*args] end |
#to_i(index, length) ⇒ Object
17 18 19 |
# File 'lib/geo_pattern/seed.rb', line 17 def to_i(index, length) seed[index, length || 1].to_i(16) end |