class Gum::Filters::Geo::Bbox::ParamParser
Attributes
bottom[R]
left[R]
right[R]
top[R]
Public Class Methods
new(order)
click to toggle source
# File lib/gum/filters/geo/bbox.rb, line 35 def initialize(order) @order = order || 'top,left,bottom,right' @regexp = regexp end
Public Instance Methods
empty?(value)
click to toggle source
# File lib/gum/filters/geo/bbox.rb, line 40 def empty?(value) !@regexp.match(value) end
parse(value)
click to toggle source
# 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
Private Instance Methods
number_pattern()
click to toggle source
# File lib/gum/filters/geo/bbox.rb, line 56 def number_pattern '-?\\d{,3}\\.?\\d{,16}' end
regexp()
click to toggle source
# File lib/gum/filters/geo/bbox.rb, line 60 def regexp order = @order.split(',').map do |param| "(?<#{param}>#{number_pattern})" end.join(',') /^#{order}$/ end