Class: Gtk::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/rabbit/gtk.rb,
lib/rabbit/action.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ Action

Returns a new instance of Action.



91
92
93
94
95
96
97
# File 'lib/rabbit/gtk.rb', line 91

def initialize(name, options={})
  initialize_raw(name,
                 options[:label],
                 options[:tooltip],
                 options[:stock_id])

end

Instance Method Details

#_activateObject



5
# File 'lib/rabbit/action.rb', line 5

alias _activate activate

#activate(&block) ⇒ Object



6
7
8
9
10
11
# File 'lib/rabbit/action.rb', line 6

def activate(&block)
  @block = block
  _activate
ensure
  @block = nil
end

#block_given?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/rabbit/action.rb', line 13

def block_given?
  not @block.nil?
end

#call(*args, &block) ⇒ Object



17
18
19
# File 'lib/rabbit/action.rb', line 17

def call(*args, &block)
  @block.call(*args, &block)
end

#initialize_rawObject



90
# File 'lib/rabbit/gtk.rb', line 90

alias_method :initialize_raw, :initialize