Class: Holoserve::Request::Selector
- Inherits:
-
Object
- Object
- Holoserve::Request::Selector
- Defined in:
- lib/holoserve/request/selector.rb
Instance Attribute Summary collapse
-
#request ⇒ Object
Returns the value of attribute request.
Instance Method Summary collapse
-
#initialize(request, request_subsets) ⇒ Selector
constructor
A new instance of Selector.
- #selection ⇒ Object
Constructor Details
#initialize(request, request_subsets) ⇒ Selector
Returns a new instance of Selector.
6 7 8 |
# File 'lib/holoserve/request/selector.rb', line 6 def initialize(request, request_subsets) @request, @request_subsets = request, request_subsets end |
Instance Attribute Details
#request ⇒ Object
Returns the value of attribute request.
4 5 6 |
# File 'lib/holoserve/request/selector.rb', line 4 def request @request end |
Instance Method Details
#selection ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/holoserve/request/selector.rb', line 10 def selection if Holoserve::Tool::Hash::Matcher.new(@request, @request_subsets[:default]).match? @request_subsets.each do |variant, subset| next if variant == :default return variant if Holoserve::Tool::Hash::Matcher.new(@request, subset).match? end return :default end nil end |