Class: Rack::Mount::Analysis::Splitting::Key
- Inherits:
-
Struct
- Object
- Struct
- Rack::Mount::Analysis::Splitting::Key
- Defined in:
- lib/rack/mount/analysis/splitting.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
Returns the value of attribute index.
-
#method ⇒ Object
Returns the value of attribute method.
-
#separators ⇒ Object
Returns the value of attribute separators.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index
8 9 10 |
# File 'lib/rack/mount/analysis/splitting.rb', line 8 def index @index end |
#method ⇒ Object
Returns the value of attribute method
8 9 10 |
# File 'lib/rack/mount/analysis/splitting.rb', line 8 def method @method end |
#separators ⇒ Object
Returns the value of attribute separators
8 9 10 |
# File 'lib/rack/mount/analysis/splitting.rb', line 8 def separators @separators end |
Class Method Details
.split(value, separator_pattern) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/rack/mount/analysis/splitting.rb', line 9 def self.split(value, separator_pattern) keys = value.split(separator_pattern) keys.shift if keys[0] == '' keys << NULL keys end |
Instance Method Details
#call(cache, obj) ⇒ Object
16 17 18 |
# File 'lib/rack/mount/analysis/splitting.rb', line 16 def call(cache, obj) (cache[method] ||= self.class.split(obj.send(method), separators))[index] end |
#call_source(cache, obj) ⇒ Object
20 21 22 |
# File 'lib/rack/mount/analysis/splitting.rb', line 20 def call_source(cache, obj) "(#{cache}[:#{method}] ||= Analysis::Splitting::Key.split(#{obj}.#{method}, #{separators.inspect}))[#{index}]" end |
#inspect ⇒ Object
24 25 26 |
# File 'lib/rack/mount/analysis/splitting.rb', line 24 def inspect "#{method}[#{index}].split(#{separators.inspect})" end |