Sha256: 58b423d4642389ca44ed4d9b06e68c00ef45c80d0ec203b3815b089668dfbe85

Contents?: true

Size: 708 Bytes

Versions: 6

Compression:

Stored size: 708 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

6 entries across 6 versions & 1 rubygems

Version Path
arstotzka-1.6.2 spec/support/models/arstotzka/dummy.rb
arstotzka-1.6.1 spec/support/models/arstotzka/dummy.rb
arstotzka-1.6.0 spec/support/models/arstotzka/dummy.rb
arstotzka-1.5.0 spec/support/models/arstotzka/dummy.rb
arstotzka-1.4.4 spec/support/models/arstotzka/dummy.rb
arstotzka-1.4.3 spec/support/models/arstotzka/dummy.rb