Sha256: bf888bd9982350c568d1e73b8ed9eeb61b943c4c212a048d2d7c8ea6afa9954b

Contents?: true

Size: 1.03 KB

Versions: 14

Compression:

Stored size: 1.03 KB

Contents

require 'erb'
require 'cgi'

module Redcar
  class ViewShortcuts
    def self.menus
      Menu::Builder.build do
        sub_menu "Help" do
          item "Keyboard Shortcuts", :command => ViewShortcuts::ViewCommand, :priority => 30
        end
      end
    end
  
    class ViewCommand < Redcar::Command
      def execute
        controller = Controller.new
        tab = win.new_tab(HtmlTab)
        tab.html_view.controller = controller
        tab.focus
      end
    end
    
    class Controller
      include HtmlController
      
      def title
        "Shortcuts"
      end
      
      def clean_name(command)
        name = command.to_s.sub("Command","")
        idx = name.rindex("::")
        unless idx.nil?
          name = name[idx+2,name.length]
        end
        name = name.split(/(?=[A-Z])/).map{|w| w}.join(" ").sub("R E P L","REPL")
      end
      
      def index
        rhtml = ERB.new(File.read(File.join(File.dirname(__FILE__), "..", "views", "index.html.erb")))
        rhtml.result(binding)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
redcar-0.5.1 plugins/view_shortcuts/lib/view_shortcuts.rb
redcar-0.5 plugins/view_shortcuts/lib/view_shortcuts.rb
redcar-0.5.6dev plugins/view_shortcuts/lib/view_shortcuts.rb
redcar-0.5.5dev plugins/view_shortcuts/lib/view_shortcuts.rb
redcar-0.5.4dev plugins/view_shortcuts/lib/view_shortcuts.rb
redcar-0.5.3dev plugins/view_shortcuts/lib/view_shortcuts.rb
redcar-0.5.2dev plugins/view_shortcuts/lib/view_shortcuts.rb
redcar-0.5.1dev plugins/view_shortcuts/lib/view_shortcuts.rb
redcar-0.4.1 plugins/view_shortcuts/lib/view_shortcuts.rb
redcar-0.4 plugins/view_shortcuts/lib/view_shortcuts.rb
redcar-0.3.10.1dev plugins/view_shortcuts/lib/view_shortcuts.rb
redcar-0.3.10.0dev plugins/view_shortcuts/lib/view_shortcuts.rb
redcar-0.3.9 plugins/view_shortcuts/lib/view_shortcuts.rb
redcar-0.3.9.0dev plugins/view_shortcuts/lib/view_shortcuts.rb