Sha256: 00353fad9f64780fd39d56e722aaeae0992acaef27c0d129a4f36edadc0d3745

Contents?: true

Size: 653 Bytes

Versions: 10

Compression:

Stored size: 653 Bytes

Contents

class Object

  def j
    to_json
  end

  def jj
    JSON.pretty_generate(JSON.parse(to_json))
  end

  def jp
    puts j
  end

  def jjp
    puts jj
  end

  def a
    [self]
  end

  class << self
    def const_missing(name)
      return super unless const_defined?(:Arql)
      return super unless Arql.const_defined?(:App)
      return super unless Arql::App.instance&.definitions&.present?

      Arql::App.instance.definitions.lazy.filter do |_, definition|
        definition.namespace_module.const_defined?(name)
      end.map do |_, definition|
          definition.namespace_module.const_get(name)
      end.first || super
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
arql-0.4.12 lib/arql/ext/object.rb
arql-0.4.11 lib/arql/ext/object.rb
arql-0.4.10 lib/arql/ext/object.rb
arql-0.4.8 lib/arql/ext/object.rb
arql-0.4.7 lib/arql/ext/object.rb
arql-0.4.6 lib/arql/ext/object.rb
arql-0.4.3 lib/arql/ext/object.rb
arql-0.4.2 lib/arql/ext/object.rb
arql-0.4.1 lib/arql/ext/object.rb
arql-0.4.0 lib/arql/ext/object.rb