Class: Shoes::Types::Widget

Inherits:
Object
  • Object
show all
Defined in:
lib/shoes.rb

Class Method Summary collapse

Class Method Details

.inherited(subc) ⇒ Object


463
464
465
466
467
468
469
470
471
472
473
474
# File 'lib/shoes.rb', line 463

def self.inherited(subc)
  methc = subc.to_s[/(^|::)(\w+)$/, 2]
          .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
          .gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase
  @types[methc] = subc
  Shoes.class_eval %{
    def #{methc}(*a, &b)
      a.unshift Widget.instance_variable_get("@types")[#{methc.dump}]
      widget(*a, &b)
    end
  }
end