Class: Gum::Filters::Geo::Bbox::ParamParser

Inherits:
Object
  • Object
show all
Defined in:
lib/gum/filters/geo/bbox.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bottomObject (readonly)

Returns the value of attribute bottom.



33
34
35
# File 'lib/gum/filters/geo/bbox.rb', line 33

def bottom
  @bottom
end

#leftObject (readonly)

Returns the value of attribute left.



33
34
35
# File 'lib/gum/filters/geo/bbox.rb', line 33

def left
  @left
end

#rightObject (readonly)

Returns the value of attribute right.



33
34
35
# File 'lib/gum/filters/geo/bbox.rb', line 33

def right
  @right
end

#topObject (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

Returns:

  • (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