Sha256: 85c625b77140707f49e8906fb739dd913c10d956fca2be12eea7e54979aeba11

Contents?: true

Size: 904 Bytes

Versions: 2

Compression:

Stored size: 904 Bytes

Contents

require "rails/engine"
require "rails_imager/engine"
require "string-cases"
require "datet"
require "knjrbfw"
require "RMagick" unless ::Kernel.const_defined?(:RMagick)

module RailsImager
  def self.const_missing(name)
    if name.to_s.end_with?("Controller")
      path = "#{File.dirname(__FILE__)}/../app/controllers/rails_imager/#{::StringCases.camel_to_snake(name)}.rb"
    elsif name.to_s.end_with?("Helper")
      path = "#{File.dirname(__FILE__)}/../app/helpers/rails_imager/#{::StringCases.camel_to_snake(name)}.rb"
    else
      path = "#{File.dirname(__FILE__)}/rails_imager/#{::StringCases.camel_to_snake(name)}.rb"
    end

    if File.exists?(path)
      require path
      return const_get(name) if const_defined?(name)
    end

    super
  end

  @config = RailsImager::Config.new
  def self.config
    if block_given?
      yield @config
    else
      return @config
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_imager-0.0.21 lib/rails_imager.rb
rails_imager-0.0.20 lib/rails_imager.rb