Sha256: c0b46b36225c6f4a4814ab1780c32a3fb20919036b8137c9dfca8a0e534e598d

Contents?: true

Size: 948 Bytes

Versions: 7

Compression:

Stored size: 948 Bytes

Contents

module Graphdb
  module Model
    module Extensions
      module OpenAssets
        module TxOut

          def self.prepended(base)
            class << base
              self.prepend(ClassMethods)

            end
            base.class_eval do
              property :asset_quantity, type: Integer
              property :oa_output_type
              has_one :out, :asset_id, type: :asset_id, model_class: 'Graphdb::Model::AssetId'
            end
          end

          module ClassMethods

          end

          def apply_oa_attributes(oa_out)
            self.asset_quantity = oa_out['asset_quantity']
            self.oa_output_type = oa_out['output_type']
            self.asset_id = oa_out['asset_id'].nil? ? nil : AssetId.find_or_create(oa_out['asset_id'])
            self.oa_output_type = 'uncolored' if self.asset_id.nil? && self.oa_output_type != 'marker'
            save!
          end

        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bitcoin2graphdb-0.4.0 lib/graphdb/model/extensions/open_assets/tx_out.rb
bitcoin2graphdb-0.3.9 lib/graphdb/model/extensions/open_assets/tx_out.rb
bitcoin2graphdb-0.3.8 lib/graphdb/model/extensions/open_assets/tx_out.rb
bitcoin2graphdb-0.3.7 lib/graphdb/model/extensions/open_assets/tx_out.rb
bitcoin2graphdb-0.3.6 lib/graphdb/model/extensions/open_assets/tx_out.rb
bitcoin2graphdb-0.3.5 lib/graphdb/model/extensions/open_assets/tx_out.rb
bitcoin2graphdb-0.3.4 lib/graphdb/model/extensions/open_assets/tx_out.rb