Module: Htmless::DynamicClasses::Describable
- Included in:
- DescribableClass
- Defined in:
- lib/htmless/dynamic_classes.rb
Overview
Adds ability to describe itself when class is defined without constant
Defined Under Namespace
Modules: ClassMethods
Class Method Summary (collapse)
Instance Method Summary (collapse)
Class Method Details
+ (Object) included(base)
48 49 50 51 |
# File 'lib/htmless/dynamic_classes.rb', line 48 def self.included(base) base.singleton_class.send :alias_method, :original_to_s, :to_s base.extend ClassMethods end |
Instance Method Details
- (Object) to_s
65 66 67 68 |
# File 'lib/htmless/dynamic_classes.rb', line 65 def to_s klass = respond_to?(:rclass) ? self.rclass : self.class super.gsub(klass.original_to_s, klass.to_s) end |