Class: GoMaps::Direction
- Inherits:
-
Object
- Object
- GoMaps::Direction
- Defined in:
- lib/go_maps/direction.rb
Instance Method Summary collapse
-
#initialize(params) ⇒ Direction
constructor
A new instance of Direction.
- #to_html(options = {}) ⇒ Object
- #to_map(options = {}) ⇒ Object
Constructor Details
#initialize(params) ⇒ Direction
Returns a new instance of Direction.
3 4 5 6 |
# File 'lib/go_maps/direction.rb', line 3 def initialize(params) @from = params[:from] @to = params[:to] end |
Instance Method Details
#to_html(options = {}) ⇒ Object
14 15 16 |
# File 'lib/go_maps/direction.rb', line 14 def to_html( = {}) Address.new(@from).route_to(@to, :language => [:language])['steps'].map { |step| "<div class=\"step\">#{step['html_instructions']}</div>" }.join end |
#to_map(options = {}) ⇒ Object
8 9 10 11 12 |
# File 'lib/go_maps/direction.rb', line 8 def to_map( = {}) [:width] ||= 425 [:height] ||= 350 "<iframe width='#{[:width]}' height='#{[:height]}' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='#{map_url(@from, @to)}'></iframe>" end |