Sha256: 95648ec27fcc86cfdfe7715d4052a8908d79da79b9dfd37528c792747ac2e260

Contents?: true

Size: 841 Bytes

Versions: 1

Compression:

Stored size: 841 Bytes

Contents

require "archon/version"

# = Archon
#
# Archon is a collection of Arel nodes, shortcut methods and ActiveRecord model methods that make
# doing complicated stuff relatively simpler.
module Archon
  extend ActiveSupport::Autoload

  autoload :Nodes
  autoload :InsertIntoSelect
  autoload :PowerOverwhelming

  def self.method_missing(called_method_name, *arguments, &block)
    # Call super to raise a method missing error if no class was loaded:
    called_method_name_as_constant = called_method_name.to_s.camelize
    super unless [
      "Archon::Nodes::#{called_method_name_as_constant}".safe_constantize,
      "Archon::#{called_method_name_as_constant}".safe_constantize
    ].compact!.any?

    # Try again, this time we expect the loaded module added the method to Archon:
    send called_method_name, *arguments, &block
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
archon-0.0.3 lib/archon.rb