module EL::AceHelpers

Constants

ASSETS_EXT
ASSETS_PATH
ASSETS_REGEXP
FONT_SIZES
MODES
MODE_MAP
TAB_SIZES
THEMES

Public Instance Methods

normalize_editor_id(smth) click to toggle source
# File lib/el-ace/el-ace.rb, line 110
def normalize_editor_id smth
  # removing non-alphanumerics as well as underscores,
  # otherwise Ace does not recognize it as a valid id.
  # also, it is important to add the digest, cause without it
  # all of "ab", "a_b", "a-b" will result in same id
  ('ELAceEditor' << Digest::MD5.hexdigest(smth.to_s) << smth.to_s).gsub(/\W|_/, '').freeze
end
normalize_snippets(*snippets) click to toggle source
# File lib/el-ace/el-ace.rb, line 118
def normalize_snippets *snippets
  snippets = snippets[0].call if snippets[0].is_a?(Proc)
  snippets.compact.flatten.map {|s| s.to_s.gsub("'", '"')}.freeze
end
stringify_opts(*keys) click to toggle source
# File lib/el-ace/el-ace.rb, line 123
def stringify_opts *keys
  keys.inject([]) {|a,o| (v = @opts[o]) ? a << ('%s: "%s"' % [o,v]) : a}*', '
end