Sha256: ba14a639662a66bec80a5cb72d08b87ad964297023c5f87655c4a0dc452289c3
Contents?: true
Size: 907 Bytes
Versions: 3
Compression:
Stored size: 907 Bytes
Contents
module TkInspectRails module SqlPanel class Base attr_accessor :tk_root attr_accessor :main_component def initialize @tk_root = nil @main_component = nil end def refresh @main_component.nil? ? create_root : @main_component.regenerate end def create_root @tk_root = TkComponent::Window.new(title: "SQL Panel") @main_component = RootComponent.new @main_component.sql_panel = self @tk_root.place_root_component(@main_component) create_menu end def execute_sql(expression) ActiveRecord::Base.connection.execute(expression) end # So far, we only register key accelerators. Menus are better inherited from main console def create_menu @tk_root.tk_item.native_item.bind('Command-r', -> { main_component.execute_sql(nil) }) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tk_inspect_rails-0.2.1 | lib/tk_inspect_rails/sql_panel/base.rb |
tk_inspect_rails-0.2.0 | lib/tk_inspect_rails/sql_panel/base.rb |
tk_inspect_rails-0.1.0 | lib/tk_inspect_rails/sql_panel/base.rb |