Sha256: c87d973aeef990d4189406bef662a4ffb5447a9a70ba2b0ac8a890901f3a035d

Contents?: true

Size: 862 Bytes

Versions: 1

Compression:

Stored size: 862 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
  autoload :Visitors

  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.4 lib/archon.rb