Sha256: 14d2e5f24eb47f983dc8afb64a7979ffa0f40624dd4b2e35fc7fb50c2dd6e984

Contents?: true

Size: 894 Bytes

Versions: 8

Compression:

Stored size: 894 Bytes

Contents

# frozen_string_literal: true

require "zeitwerk"
require "phlex"
require "active_support/core_ext/object/blank"

module Phlexi
  NIL_VALUE = :__i_phlexi_i__

  module Field
    Loader = Zeitwerk::Loader.new.tap do |loader|
      loader.tag = File.basename(__FILE__, ".rb")
      loader.ignore("#{__dir__}/field/version.rb")
      loader.inflector.inflect(
        "phlexi-field" => "Phlexi",
        "phlexi" => "Phlexi",
        "dom" => "DOM"
      )
      loader.push_dir(File.expand_path("..", __dir__))
      loader.setup
    end

    COMPONENT_BASE = (defined?(::ApplicationComponent) ? ::ApplicationComponent : Phlex::HTML)

    class Error < StandardError; end

    def self.object_primary_key(object)
      if object.class.respond_to?(:primary_key)
        object.send(object.class.primary_key.to_sym)
      elsif object.respond_to?(:id)
        object.id
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
phlexi-field-0.0.11 lib/phlexi/field.rb
phlexi-field-0.0.10 lib/phlexi/field.rb
phlexi-field-0.0.9 lib/phlexi/field.rb
phlexi-field-0.0.8 lib/phlexi/field.rb
phlexi-field-0.0.7 lib/phlexi/field.rb
phlexi-field-0.0.6 lib/phlexi/field.rb
phlexi-field-0.0.5 lib/phlexi/field.rb
phlexi-field-0.0.4 lib/phlexi/field.rb