Class: MapLayers::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/map_layers/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model_id, options) ⇒ Config

Returns a new instance of Config.


6
7
8
9
10
11
12
13
# File 'lib/map_layers/config.rb', line 6

def initialize(model_id, options)
  @model_id = model_id.to_s.pluralize.singularize
  @id = options[:id] || :id
  @lat = options[:lat] || :lat
  @lon = options[:lon] || :lng
  @geometry = options[:geometry]
  @text = options[:text] || :name
end

Instance Attribute Details

#geometryObject (readonly)

Returns the value of attribute geometry


4
5
6
# File 'lib/map_layers/config.rb', line 4

def geometry
  @geometry
end

#idObject (readonly)

Returns the value of attribute id


4
5
6
# File 'lib/map_layers/config.rb', line 4

def id
  @id
end

#latObject (readonly)

Returns the value of attribute lat


4
5
6
# File 'lib/map_layers/config.rb', line 4

def lat
  @lat
end

#lonObject (readonly)

Returns the value of attribute lon


4
5
6
# File 'lib/map_layers/config.rb', line 4

def lon
  @lon
end

#model_idObject (readonly)

Returns the value of attribute model_id


4
5
6
# File 'lib/map_layers/config.rb', line 4

def model_id
  @model_id
end

#textObject (readonly)

Returns the value of attribute text


4
5
6
# File 'lib/map_layers/config.rb', line 4

def text
  @text
end

Instance Method Details

#modelObject


15
16
17
# File 'lib/map_layers/config.rb', line 15

def model
  @model ||= @model_id.to_s.camelize.constantize
end