Class: Innate::URLMap
- Inherits:
-
Rack::URLMap
- Object
- Rack::URLMap
- Innate::URLMap
- Defined in:
- /home/manveru/github/ramaze/ramaze.net/tmp/git/innate/lib/innate/dynamap.rb
Instance Method Summary (collapse)
-
- (Object) at(location)
-
- (Object) call(env)
-
- (Object) delete(location)
-
- (URLMap) initialize(map = {})
constructor
A new instance of URLMap.
-
- (Object) map(location, object)
-
- (Object) remap(map)
super may raise when given invalid locations, so we only replace the
@originals
if we are sure the new map is valid. -
- (Object) to(object)
-
- (Object) to_hash
Constructor Details
- (URLMap) initialize(map = {})
Returns a new instance of URLMap
3 4 5 6 |
# File '/home/manveru/github/ramaze/ramaze.net/tmp/git/innate/lib/innate/dynamap.rb', line 3 def initialize(map = {}) @originals = map super end |
Instance Method Details
- (Object) at(location)
26 27 28 |
# File '/home/manveru/github/ramaze/ramaze.net/tmp/git/innate/lib/innate/dynamap.rb', line 26 def at(location) @originals[location] end |
- (Object) call(env)
38 39 40 41 |
# File '/home/manveru/github/ramaze/ramaze.net/tmp/git/innate/lib/innate/dynamap.rb', line 38 def call(env) raise "Nothing mapped yet" if @originals.empty? super end |
- (Object) delete(location)
21 22 23 24 |
# File '/home/manveru/github/ramaze/ramaze.net/tmp/git/innate/lib/innate/dynamap.rb', line 21 def delete(location) @originals.delete(location) remap(@originals) end |
- (Object) map(location, object)
16 17 18 19 |
# File '/home/manveru/github/ramaze/ramaze.net/tmp/git/innate/lib/innate/dynamap.rb', line 16 def map(location, object) return unless location and object remap(@originals.merge(location.to_s => object)) end |
- (Object) remap(map)
super may raise when given invalid locations, so we only replace the
@originals
if we are sure the new map is valid
10 11 12 13 14 |
# File '/home/manveru/github/ramaze/ramaze.net/tmp/git/innate/lib/innate/dynamap.rb', line 10 def remap(map) value = super @originals = map value end |
- (Object) to(object)
30 31 32 |
# File '/home/manveru/github/ramaze/ramaze.net/tmp/git/innate/lib/innate/dynamap.rb', line 30 def to(object) @originals.invert[object] end |
- (Object) to_hash
34 35 36 |
# File '/home/manveru/github/ramaze/ramaze.net/tmp/git/innate/lib/innate/dynamap.rb', line 34 def to_hash @originals.dup end |