Class: Identities
- Inherits:
-
Object
- Object
- Identities
- Defined in:
- lib/passage/identities.rb
Instance Method Summary collapse
- #[](index) ⇒ Object
- #count ⇒ Object
-
#initialize(hash) ⇒ Identities
constructor
A new instance of Identities.
Constructor Details
#initialize(hash) ⇒ Identities
Returns a new instance of Identities.
2 3 4 5 6 7 8 9 10 11 12 |
# File 'lib/passage/identities.rb', line 2 def initialize(hash) @regex = {} @hash = {} hash.keys.each do |k| if k.is_a? Regexp @regex[k] = hash[k] else @hash[k] = hash[k] end end end |
Instance Method Details
#[](index) ⇒ Object
14 15 16 |
# File 'lib/passage/identities.rb', line 14 def [](index) @hash[index] || regex_lookup(index) end |
#count ⇒ Object
18 19 20 |
# File 'lib/passage/identities.rb', line 18 def count @hash.keys.count + @regex.keys.count end |