Module: Liquor::DropDelegation

Extended by:
DropDelegation
Included in:
DropDelegation
Defined in:
lib/liquor/drop/drop_delegation.rb

Instance Method Summary collapse

Instance Method Details

#unwrap_drop_class(klass) ⇒ Object



18
19
20
21
22
# File 'lib/liquor/drop/drop_delegation.rb', line 18

def unwrap_drop_class(klass)
  drop_klass_name  = klass.name
  model_class_name = drop_klass_name.sub(/Drop$/, '')
  model_class_name.constantize
end

#wrap_element(element) ⇒ Object



11
12
13
14
15
16
# File 'lib/liquor/drop/drop_delegation.rb', line 11

def wrap_element(element)
  unless element.nil?
    drop_klass = "#{element.class.name}Drop".constantize
    drop_klass.new(element)
  end
end

#wrap_scope(scope, klass = scope) ⇒ Object



6
7
8
9
# File 'lib/liquor/drop/drop_delegation.rb', line 6

def wrap_scope(scope, klass=scope)
  drop_klass = "#{klass.name}Drop::Scope".constantize
  drop_klass.new(scope)
end