Class: Shaven::Transformer::Auto

Inherits:
Base
  • Object
show all
Defined in:
lib/shaven/transformers/auto.rb

Overview

Its job is to automatically recognize which transformer should be applied using specified settings. Regocnition is done by matching value type.

Class Method Summary collapse

Class Method Details

.new(name, value, scope) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/shaven/transformers/auto.rb', line 6

def self.new(name, value, scope)
  if Context.can_be_transformed?(value)
    Context.new(name, value, scope)
  elsif List.can_be_transformed?(value)
    List.new(name, value, scope)
  else
    TextOrNode.new(name, value, scope)
  end
end