Module: SnippetsConverter::Editors::Ruble

Defined in:
lib/snippets_converter/editors/ruble.rb

Instance Method Summary collapse

Instance Method Details

#editor_bottomObject



25
26
27
28
# File 'lib/snippets_converter/editors/ruble.rb', line 25

def editor_bottom

  "end"
end

#editor_conversion(trigger, description, code) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/snippets_converter/editors/ruble.rb', line 5

def editor_conversion(trigger, description, code)
  # Need to escape double quote for description and code because Ruble doesn't seem to like it
  return <<-CODE
  snippet "#{description.gsub(/\"/,'\"')}" do |snippet|
    snippet.trigger = "#{trigger}"
    snippet.expansion = "#{code.gsub(/\"/,'\"')}"
  end

  CODE
end

#editor_header(language = 'source.ruby') ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/snippets_converter/editors/ruble.rb', line 16

def editor_header(language = 'source.ruby')
  return <<-CODE
require 'ruble'

with_defaults :scope => "#{language}" do |bundle|

  CODE
end

#editor_target_file(language = 'ruble') ⇒ Object



30
31
32
# File 'lib/snippets_converter/editors/ruble.rb', line 30

def editor_target_file(language = 'ruble')
  "#{language.gsub(/.+\.(.+)/,'\1')}_snippets.rb"
end