Class: Dust::Map

Inherits:
Object
  • Object
show all
Defined in:
app/models/dust/map.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Map

Returns a new instance of Map.



6
7
8
9
10
11
# File 'app/models/dust/map.rb', line 6

def initialize(options={})
  @address = options[:address] ||= "Lalana Ramboatiana, Antananarivo, Madagascar"
  @width   = options[:width] ||= 400
  @height  = options[:height] ||= 400
  @content = options[:content]||= "Madagascar Royal Palace"
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



4
5
6
# File 'app/models/dust/map.rb', line 4

def address
  @address
end

#contentObject

Returns the value of attribute content.



4
5
6
# File 'app/models/dust/map.rb', line 4

def content
  @content
end

#heightObject

Returns the value of attribute height.



4
5
6
# File 'app/models/dust/map.rb', line 4

def height
  @height
end

#widthObject

Returns the value of attribute width.



4
5
6
# File 'app/models/dust/map.rb', line 4

def width
  @width
end

Class Method Details

.find(map_name) ⇒ Object



13
14
15
16
17
# File 'app/models/dust/map.rb', line 13

def self.find(map_name)
  maps = Hashie::Mash.new(YAML.load(File.read("#{Rails.root}/config/maps.yml")))
  map_options = maps[map_name] ||= {}
  return Map.new map_options
end