Sha256: ee85b4fb593c8e178a40d9a7ab4c61e321a94179af0d460092e41b8c67fcd014
Contents?: true
Size: 561 Bytes
Versions: 13
Compression:
Stored size: 561 Bytes
Contents
require 'apple-news/scenes/base' Dir["#{File.dirname(__FILE__)}/scenes/*.rb"].each { |path| require path } module AppleNews module Scene extend self def factory(data) return if data.nil? scenes.each do |scene| if scene.type == data[:type] return scene.new(data) end end nil end private def scenes @scenes ||= self.constants. map { |const| self.const_get(const) }. select { |const| const.name.demodulize != "Base" && const.is_a?(Class) } end end end
Version data entries
13 entries across 13 versions & 1 rubygems