Class: Types::Widget

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

Constant Summary

@@types =
{}

Class Method Summary collapse

Class Method Details

.inherited(subc) ⇒ Object



537
538
539
540
541
542
543
544
545
546
547
548
# File 'lib/shoes.rb', line 537

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.class_variable_get("@@types")[#{methc.dump}]
      widget(*a, &b)
    end
  }
end