Module: Spectra::Views

Defined in:
lib/spectra/views/factory.rb

Class Method Summary collapse

Class Method Details

.from_attributes(attributes) ⇒ Object



10
11
12
13
# File 'lib/spectra/views/factory.rb', line 10

def self.from_attributes(attributes)
  klass = self.view_class(attributes[:type]) 
  klass.from_attributes(attributes) 
end

.view_class(type) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/spectra/views/factory.rb', line 15

def self.view_class(type)
  case type.intern
    when :palette
      Palette
    when :objc    
      ObjcCategory
    when :swift   
      SwiftExtension
  end
end