Class: Lite::Decorator::Base
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Lite::Decorator::Base
- Defined in:
- lib/lite/decorator/base.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.decorate(object) ⇒ Object
9 10 11 12 13 |
# File 'lib/lite/decorator/base.rb', line 9 def self.decorate(object) return new(object) unless object.respond_to?(:each) object.map { |obj| new(obj) } end |
Instance Method Details
#class ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/lite/decorator/base.rb', line 15 def class if object.class.respond_to?(:table_name) object.class else super end end |
#object ⇒ Object
23 24 25 |
# File 'lib/lite/decorator/base.rb', line 23 def object __getobj__ end |
#to_model ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/lite/decorator/base.rb', line 27 def to_model if object.respond_to?(:to_model) super else object end end |