Class: EmbedRb::Gmap

Inherits:
Object
  • Object
show all
Defined in:
lib/embedrb/embed_gmap.rb

Instance Method Summary collapse

Constructor Details

#initialize(input, output, options, embeds) ⇒ Gmap

Returns a new instance of Gmap.



7
8
9
10
11
12
13
# File 'lib/embedrb/embed_gmap.rb', line 7

def initialize(input, output, options, embeds)
  @input = input
  @output = output
  @embeds = embeds
  @options = options
  @regex = /@\((.+)\)/i
end

Instance Method Details

#processObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/embedrb/embed_gmap.rb', line 15

def process()
  if @options[:gmapOptions][:googleAuthKey]
    @input.scan(@regex) {|match|
      location = match[0]
      @embeds << {
        key: match,
        text: render(location)
      }
    }
  end

  @output
end