class CardmarketCLI::Entities::Changeable

Base for all entities with changeable attributes in the API

Attributes

changed[W]

Public Class Methods

new(id, account, params) click to toggle source
Calls superclass method
# File lib/cardmarket_cli/entities/changeable.rb, line 10
def initialize(id, account, params)
  super(id, account, params)
  @changed = false
end

Protected Class Methods

attr_(*symbols) click to toggle source
# File lib/cardmarket_cli/entities/changeable.rb, line 26
def attr_(*symbols)
  attr_r(*symbols)
  symbols.each do |symbol|
    define_method "#{symbol}=" do |val|
      return if @params[symbol] == val

      @params[symbol] = val
      @changed = true
    end
  end
end

Public Instance Methods

changed?() click to toggle source
# File lib/cardmarket_cli/entities/changeable.rb, line 15
def changed?
  @changed
end