Sha256: 34a62913a785fcdb8c5f13bbb5cfddf1f9a20844d6c81a40a25f5e05f69c56bc

Contents?: true

Size: 707 Bytes

Versions: 5

Compression:

Stored size: 707 Bytes

Contents

# frozen_string_literal: true

module Arstotzka
  class Dummy
    include Arstotzka
    attr_reader :json

    expose 'id'
    expose :name, path: 'user'
    expose :father_name, full_path: 'father.name'
    expose :age, cached: true
    expose :house, klass: ::House
    expose :old_house, klass: ::House, cached: true
    expose :games, klass: ::Game
    expose :games_filtered, klass: ::Game, after: :filter_games, full_path: 'games'

    def initialize(json)
      @json = json
    end

    def filter_games(games)
      games.reject do |g|
        g.publisher == 'sega'
      end
    end

    def ==(other)
      return false unless other.class == self.class
      json == other.json
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
arstotzka-1.4.2 spec/support/models/arstotzka/dummy.rb
arstotzka-1.4.1 spec/support/models/arstotzka/dummy.rb
arstotzka-1.4.0 spec/support/models/arstotzka/dummy.rb
arstotzka-1.3.2 spec/support/models/arstotzka/dummy.rb
arstotzka-1.3.1 spec/support/models/arstotzka/dummy.rb