class Cryptopunks::Metadata
wrap metadata (e.g. punk types, accessories, etc.
in structs for easy/easier access)
Attributes
accessories[R]
birthday[R]
id[R]
type[R]
Public Class Methods
new( id, type, accessories )
click to toggle source
# File lib/cryptopunks/structs.rb, line 133 def initialize( id, type, accessories ) @id = id @type = type @accessories = accessories @birthday = Date.new( 2017, 6, 23) ## all 10,000 minted on June 23, 2017 end
Public Instance Methods
alien?()
click to toggle source
convenience helpers for “classic” (5) types
# File lib/cryptopunks/structs.rb, line 144 def alien?() is_type?( 'Alien'); end
ape?()
click to toggle source
# File lib/cryptopunks/structs.rb, line 145 def ape?() is_type?( 'Ape' ); end
female?()
click to toggle source
# File lib/cryptopunks/structs.rb, line 147 def female?() is_type?( 'Female' ); end
has_attribute?( name )
click to toggle source
convenience helpers to lookup attributes
# File lib/cryptopunks/structs.rb, line 151 def has_attribute?( name ) accessories.each do |acc| return true if acc.name == name end false end
is_type?( name )
click to toggle source
# File lib/cryptopunks/structs.rb, line 140 def is_type?( name ) @type.name == name; end
Also aliased as: is?
male?()
click to toggle source
# File lib/cryptopunks/structs.rb, line 148 def male?() is_type?( 'Male' ); end
zombie?()
click to toggle source
# File lib/cryptopunks/structs.rb, line 146 def zombie?() is_type?( 'Zombie' ); end