Class: Gum::Filters::Geo::Bbox::ParamParser
- Inherits:
-
Object
- Object
- Gum::Filters::Geo::Bbox::ParamParser
- Defined in:
- lib/gum/filters/geo/bbox.rb
Instance Attribute Summary collapse
-
#bottom ⇒ Object
readonly
Returns the value of attribute bottom.
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
-
#top ⇒ Object
readonly
Returns the value of attribute top.
Instance Method Summary collapse
- #empty?(value) ⇒ Boolean
-
#initialize(order) ⇒ ParamParser
constructor
A new instance of ParamParser.
- #parse(value) ⇒ Object
Constructor Details
#initialize(order) ⇒ ParamParser
Returns a new instance of ParamParser.
35 36 37 38 |
# File 'lib/gum/filters/geo/bbox.rb', line 35 def initialize(order) @order = order || 'top,left,bottom,right' @regexp = regexp end |
Instance Attribute Details
#bottom ⇒ Object (readonly)
Returns the value of attribute bottom.
33 34 35 |
# File 'lib/gum/filters/geo/bbox.rb', line 33 def bottom @bottom end |
#left ⇒ Object (readonly)
Returns the value of attribute left.
33 34 35 |
# File 'lib/gum/filters/geo/bbox.rb', line 33 def left @left end |
#right ⇒ Object (readonly)
Returns the value of attribute right.
33 34 35 |
# File 'lib/gum/filters/geo/bbox.rb', line 33 def right @right end |
#top ⇒ Object (readonly)
Returns the value of attribute top.
33 34 35 |
# File 'lib/gum/filters/geo/bbox.rb', line 33 def top @top end |
Instance Method Details
#empty?(value) ⇒ Boolean
40 41 42 |
# File 'lib/gum/filters/geo/bbox.rb', line 40 def empty?(value) !@regexp.match(value) end |
#parse(value) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/gum/filters/geo/bbox.rb', line 44 def parse(value) match_data = @regexp.match(value) return unless match_data @top = match_data[:top].to_f @left = match_data[:left].to_f @bottom = match_data[:bottom].to_f @right = match_data[:right].to_f self end |