Module: Feeligo::Stickers

Defined in:
lib/feeligo/stickers.rb,
lib/feeligo/stickers/version.rb

Defined Under Namespace

Classes: LoaderScriptTag, StickerImageTag

Constant Summary collapse

VERSION =
"0.1.4"

Class Method Summary collapse

Class Method Details

.loader_script_tag(opts = {}) ⇒ Object

Returns a <script> tag which can be added to a View to load the Feeligo Stickers module. The <script> tag should be inserted right after the opening <body> tag



12
13
14
# File 'lib/feeligo/stickers.rb', line 12

def self.loader_script_tag opts = {}
  LoaderScriptTag.new(opts).to_s
end

.replace_sticker_tags(string, opts = {}) ⇒ Object

Takes a string and returns a copy of it with all [s:PATH] tags replaced with HTML <img> tags



19
20
21
# File 'lib/feeligo/stickers.rb', line 19

def self.replace_sticker_tags string, opts = {}
  string.gsub(/\[s:(.+?)\]/){|m| StickerImageTag.new($1, opts).to_s}
end