Class: Intercept::DecoratorBuilder
- Inherits:
-
Object
- Object
- Intercept::DecoratorBuilder
- Defined in:
- lib/intercept/decorator_builder.rb
Class Method Summary collapse
Class Method Details
.from_hash(decorator) ⇒ Object
5 6 7 8 9 |
# File 'lib/intercept/decorator_builder.rb', line 5 def self.from_hash(decorator) return unless decorator decorator_class = get_class(decorator[:name]) decorator_class.new(decorator[:args]) end |
.get_class(symbol) ⇒ Object
11 12 13 |
# File 'lib/intercept/decorator_builder.rb', line 11 def self.get_class(symbol) Object.const_get "Intercept::Decorator::#{symbol.to_s.split('_').map{ |w| w.capitalize }.join}" end |