Module: CardmarketCLI::Entities::Unique

Included in:
MetaProduct, Product, Wantslist
Defined in:
lib/cardmarket_cli/entities/unique.rb

Overview

Makes a class unique

Instance Method Summary collapse

Instance Method Details

#uniq_attr(symbol, options = {}) ⇒ Object



8
9
10
11
12
13
# File 'lib/cardmarket_cli/entities/unique.rb', line 8

def uniq_attr(symbol, options = {})
  options = { hash: true, plural: "#{symbol}s", index: :id }.merge! options
  def_brackets(options[:plural], options[:hash])
  def_add(options[:plural], options[:hash], options[:index])
  def_reader(options[:plural], options[:hash])
end