Sha256: 91b3b0b7d85157fe310fc4f7b4c528847210190fdb9b8489a22b38070b8ee0ed
Contents?: true
Size: 639 Bytes
Versions: 2
Compression:
Stored size: 639 Bytes
Contents
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 if balances end models = File.expand_path("spec/support/models/my_parser/*.rb") Dir[models].each do |file| autoload file.gsub(/.*\/(.*)\..*/, '\1').camelize.to_sym, file end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
arstotzka-1.0.1 | spec/support/models/my_parser.rb |
arstotzka-1.0.0 | spec/support/models/my_parser.rb |