Sha256: 56f316ebf8ebb41eb43911fae755aa8abc250432d0f1cf593b6cb5c32fe5c086

Contents?: true

Size: 1 KB

Versions: 36

Compression:

Stored size: 1 KB

Contents

require "rabbit/utils"

module Rabbit
  module Renderer
    module Display
      extend Utils

      class << self
        @initialized = false
        @preferred_class_name = nil
        def init(options={})
          if options.has_key?(:preferred_class_name)
            @preferred_class_name = options[:preferred_class_name]
          end
          unless @initialized
            @initialized = true
            dir = ::File.join("rabbit", "renderer", "display")
            require_files_under_directory_in_load_path(dir)
          end
        end

        def new(*args, &block)
          init
          target_class = nil
          if @preferred_class_name
            if const_defined?(@preferred_class_name)
              target_class = const_get(@preferred_class_name)
              target_class = nil unless target_class.is_a?(Class)
            end
          end
          target_class ||= corresponding_class_under_module(self)
          target_class.new(*args, &block)
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
rabbit-3.0.3 lib/rabbit/renderer/display.rb
rabbit-3.0.2 lib/rabbit/renderer/display.rb
rabbit-3.0.1 lib/rabbit/renderer/display.rb
rabbit-3.0.0 lib/rabbit/renderer/display.rb
rabbit-2.2.1 lib/rabbit/renderer/display.rb
rabbit-2.2.0 lib/rabbit/renderer/display.rb
rabbit-2.1.9 lib/rabbit/renderer/display.rb
rabbit-2.1.8 lib/rabbit/renderer/display.rb
rabbit-2.1.7 lib/rabbit/renderer/display.rb
rabbit-2.1.6 lib/rabbit/renderer/display.rb
rabbit-2.1.5 lib/rabbit/renderer/display.rb
rabbit-2.1.4 lib/rabbit/renderer/display.rb
rabbit-2.1.3 lib/rabbit/renderer/display.rb
rabbit-2.1.2 lib/rabbit/renderer/display.rb
rabbit-2.1.1 lib/rabbit/renderer/display.rb
rabbit-2.1.0 lib/rabbit/renderer/display.rb
rabbit-2.0.9 lib/rabbit/renderer/display.rb
rabbit-2.0.8 lib/rabbit/renderer/display.rb
rabbit-2.0.7 lib/rabbit/renderer/display.rb
rabbit-2.0.6 lib/rabbit/renderer/display.rb