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
11 12 13 |
# File 'lib/geo_pattern/seed.rb', line 11 def initialize(string) @seed = Digest::SHA1.hexdigest string.to_s end |
Instance Method Details
#[](*args) ⇒ Object
15 16 17 |
# File 'lib/geo_pattern/seed.rb', line 15 def [](*args) seed[*args] end |
#to_i(index, length) ⇒ Object
19 20 21 |
# File 'lib/geo_pattern/seed.rb', line 19 def to_i(index, length) seed[index, length || 1].to_i(16) end |