Sha256: 1e2e6f686f3d109e279772d76fc2a94ab4c10565a3b856894c2f0e2fe5e3344a
Contents?: true
Size: 659 Bytes
Versions: 21
Compression:
Stored size: 659 Bytes
Contents
# frozen_string_literal: true class MyParser include Arstotzka expose :id expose :name, :age, path: :person expose :total_money, full_path: 'accounts.balance', after: :sum, cached: true, type: :money_float expose :total_owed, full_path: 'loans.value', after: :sum, cached: true, type: :money_float attr_reader :json def initialize(json = {}) @json = json end private def sum(balances) balances&.sum end models = File.expand_path('spec/support/models/my_parser/*.rb') Dir[models].each do |file| autoload file.gsub(%r{.*\/(.*)\..*}, '\1').camelize.to_sym, file end end
Version data entries
21 entries across 21 versions & 1 rubygems