Sha256: 166801d9129d01d39757b9452d99043f5df8a065c585b47bfd6999c342eb23b3
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
# This is free and unencumbered software released into the public domain. ## # Represents a NEAR block. class NEAR::Block ## # @return [NEAR::Block] def self.now self.new end ## # @param [Integer, #to_i] height # @return [NEAR::Block] def self.at_height(height) self.new(height: height) end ## # @param [String, #to_s] hash # @return [NEAR::Block] def self.at_hash(hash) self.new(hash: hash) end ## # @param [Integer, #to_i] height # @param [String, #to_s] hash def initialize(height: nil, hash: nil) @height = height.to_i if height @hash = hash.to_s if hash end ## # The height of the block. # # @return [Integer] attr_reader :height ## # The hash of the block. # # @return [String] attr_reader :hash ## # @return [Array<String>] def to_cli_args return ['at-block-height', @height] if @height return ['at-block-hash', @hash] if @hash ['now'] end ## # @return [String] def to_s (@height || @hash || :now).to_s end end # NEAR::Block
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
near-0.1.0 | lib/near/block.rb |