class Sublime2yas::SublimeSubmenu
Attributes
items[R]
name[R]
Public Class Methods
excluded_items()
click to toggle source
# File lib/sublime2yas.rb, line 11 def self.excluded_items; @@excluded_items; end
new(name, hash)
click to toggle source
# File lib/sublime2yas.rb, line 14 def initialize(name, hash) @items = hash["items"] @name = name end
Public Instance Methods
to_lisp(allsubmenus, deleteditems, indent = 0, thingy = ["(", ")"])
click to toggle source
# File lib/sublime2yas.rb, line 19 def to_lisp(allsubmenus, deleteditems, indent = 0, thingy = ["(", ")"]) first = true; string = "" separator_useless = true; items.each do |uuid| if deleteditems && deleteditems.index(uuid) $stderr.puts "#{uuid} has been deleted!" next end string += "\n" string += " " * indent string += (first ? thingy[0] : (" " * thingy[0].length)) submenu = allsubmenus[uuid] snippet = SublimeSnippet::snippets_by_uid[uuid] unimplemented = SublimeSnippet::unknown_substitutions["content"][uuid] if submenu str = "(yas-submenu " string += str + "\"" + submenu.name + "\"" string += submenu.to_lisp(allsubmenus, deleteditems, indent + str.length + thingy[0].length) elsif snippet and not unimplemented string += ";; " + snippet.name + "\n" string += " " * (indent + thingy[0].length) string += "(yas-item \"" + uuid + "\")" separator_useless = false; elsif snippet and unimplemented string += ";; Ignoring " + snippet.name + "\n" string += " " * (indent + thingy[0].length) string += "(yas-ignore-item \"" + uuid + "\")" separator_useless = true; elsif (uuid =~ /---------------------/) string += "(yas-separator)" unless separator_useless end first = false; end string += ")" string += thingy[1] return string end