Sha256: 9dc2f527630df34d78e493678f39b1e98fc6b1576dbf53ceead610a9245302c2

Contents?: true

Size: 877 Bytes

Versions: 5

Compression:

Stored size: 877 Bytes

Contents

# An item is a concrete record.
# It can be part of another proxy like collection.
class LHS::Item < LHS::Proxy
  autoload :Destroy,
    'lhs/concerns/item/destroy'
  autoload :Save,
    'lhs/concerns/item/save'
  autoload :Update,
    'lhs/concerns/item/update'
  autoload :Validation,
    'lhs/concerns/item/validation'

  include Create
  include Destroy
  include Save
  include Update
  include Validation

  delegate :present?, :blank?, :empty?, to: :_raw
  delegate :_raw, to: :_data

  def collection?
    false
  end

  def item?
    true
  end

  protected

  def method_missing(name, *args, &_block)
    return set(name, args.try(&:first)) if name.to_s[/=$/]
    get(name, *args)
  end

  def respond_to_missing?(name, _include_all = false)
    # We accept every message that does not belong to set of keywords
    BLACKLISTED_KEYWORDS.exclude?(name.to_s)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lhs-12.1.0 lib/lhs/item.rb
lhs-12.0.3 lib/lhs/item.rb
lhs-12.0.2 lib/lhs/item.rb
lhs-12.0.1 lib/lhs/item.rb
lhs-12.0.0 lib/lhs/item.rb