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
11 12 13 14 15 |
# File 'lib/lite/decorator/base.rb', line 11 def decorate(object) return new(object) unless object.respond_to?(:each) object.map { |obj| new(obj) } end |
Instance Method Details
#class ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/lite/decorator/base.rb', line 19 def class if object.class.respond_to?(:table_name) object.class else super end end |
#object ⇒ Object
27 28 29 |
# File 'lib/lite/decorator/base.rb', line 27 def object __getobj__ end |
#to_model ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/lite/decorator/base.rb', line 31 def to_model if object.respond_to?(:to_model) super else object end end |