Sha256: 7ac1e0fcca5fc47c62ed0704f4e1fd85322591dd6a15b233f979216cdd1a6771

Contents?: true

Size: 1006 Bytes

Versions: 4

Compression:

Stored size: 1006 Bytes

Contents

module Redcar
  module Textmate
    class Snippet
      attr_reader :bundle_name, :key_equivalent
    
      def initialize(path, bundle_name)
        @path = path
        @plist = Plist.xml_to_plist(File.read(path))
        @bundle_name = bundle_name
        if key = @plist["keyEquivalent"]
          @key_equivalent = Textmate.translate_key_equivalent(key)
        end
      end
      
      def name
        @plist["name"]
      end
      
      def scope
        @plist["scope"]
      end
      
      def uuid
        @plist["uuid"]
      end
      
      def tab_trigger
        @plist["tabTrigger"]
      end
      
      def content
        @plist["content"]
      end
      
      def to_menu_string
        r = name.clone
        # It doesn't seem to be possible to set accelerator text on OSX.
        if Redcar.platform == :osx
          r << " (#{tab_trigger}↦)" if tab_trigger
        else
          r << "\t#{tab_trigger}" if tab_trigger
        end
        r
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
redcar-0.3.7.1 plugins/textmate/lib/textmate/snippet.rb
redcar-0.3.7 plugins/textmate/lib/textmate/snippet.rb
redcar-0.3.6 plugins/textmate/lib/textmate/snippet.rb
redcar-0.3.5 plugins/textmate/lib/textmate/snippet.rb