Sha256: f624d0f7e6bb6a40e209603879e83c847dcb7a32900ea7c9b97ea61f9631a192

Contents?: true

Size: 432 Bytes

Versions: 1

Compression:

Stored size: 432 Bytes

Contents

class ScopedSettings < Settings

  @klasses = {}

  def self.for_target(target)
    @klasses[target] ||= self.dup.instance_eval do
      def name; "ScopedSettings"; end # Required by ActiveModel::Naming
      @target = target
      self
    end
  end
  
  def self.target_id
    @target.is_a?(Class) ? nil : @target.id
  end
  
  def self.target_type
    @target.is_a?(Class) ? @target.name : @target.class.base_class.to_s
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ledermann-rails-settings-1.2.1 lib/rails-settings/scoped_settings.rb