Method: Textbringer::MinorMode.inherited
- Defined in:
- lib/textbringer/minor_mode.rb
.inherited(child) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/textbringer/minor_mode.rb', line 11 def self.inherited(child) base_name = child.name.slice(/[^:]*\z/) child.mode_name = base_name.sub(/Mode\z/, "") command_name = base_name.sub(/\A[A-Z]/) { |s| s.downcase }. gsub(/(?<=[a-z])([A-Z])/) { "_" + $1.downcase } command = command_name.intern child.command_name = command define_command(command) do Buffer.current.toggle_minor_mode(child) end end |