Sha256: 940f0945aa8095de8563fdfe6400660097589a06e9cff9b3f74d7de8f3f29445

Contents?: true

Size: 555 Bytes

Versions: 2

Compression:

Stored size: 555 Bytes

Contents

class JsonParser::Dummy
  include JsonParser
  attr_reader :json

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

  def initialize(json)
    @json = json
  end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
json_parser-1.3.1 spec/support/models/json_parser/dummy.rb
json_parser-1.3.0 spec/support/models/json_parser/dummy.rb