44uk/nis-ruby

View on GitHub
lib/nis/struct/explorer_block_view_model.rb

Summary

Maintainability
A
15 mins
Test Coverage
class Nis::Struct
  # @attr [Array <Nis::Struct::ExplorerTransferViewModel>] txes
  # @attr [Nis::Struct::Block] block
  # @attr [String] hash
  # @attr [String] difficulty
  # @see https://nemproject.github.io/#explorerBlockViewModel
  class ExplorerBlockViewModel
    include Nis::Util::Assignable
    attr_accessor :txes, :block, :hash, :difficulty

    def self.build(attrs)
      attrs[:txes] = attrs[:txes].map { |tx| ExplorerTransferViewModel.build(tx) }
      attrs[:block] = Block.build(attrs[:block])
      new(attrs)
    end
  end
end