Module: AppleNews::Behavior

Extended by:
Behavior
Included in:
Behavior
Defined in:
lib/apple-news/behavior.rb,
lib/apple-news/behaviors/base.rb,
lib/apple-news/behaviors/motion.rb,
lib/apple-news/behaviors/springy.rb,
lib/apple-news/behaviors/parallax.rb,
lib/apple-news/behaviors/background_motion.rb,
lib/apple-news/behaviors/background_parallax.rb

Defined Under Namespace

Classes: BackgroundMotion, BackgroundParallax, Base, Motion, Parallax, Springy

Instance Method Summary collapse

Instance Method Details

#factory(data) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/apple-news/behavior.rb', line 8

def factory(data)
  return if data.nil?
  
  behaviors.each do |behavior|
    if behavior.type == data[:type]
      return behavior.new(data)
    end
  end

  nil
end