Class: Cryptopunks::Metadata
- Inherits:
-
Object
- Object
- Cryptopunks::Metadata
- Defined in:
- lib/cryptopunks/structs.rb,
lib/cryptopunks/generator.rb
Defined Under Namespace
Classes: Accessory, AccessoryType, Sprite, Type
Instance Attribute Summary collapse
-
#accessories ⇒ Object
readonly
Returns the value of attribute accessories.
-
#birthday ⇒ Object
readonly
Returns the value of attribute birthday.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#alien? ⇒ Boolean
convenience helpers for “classic” (5) types.
- #ape? ⇒ Boolean
- #female? ⇒ Boolean
-
#has_attribute?(name) ⇒ Boolean
(also: #has?, #include?)
convenience helpers to lookup attributes.
-
#initialize(id, type, accessories) ⇒ Metadata
constructor
A new instance of Metadata.
- #is_type?(name) ⇒ Boolean (also: #is?)
- #male? ⇒ Boolean
- #zombie? ⇒ Boolean
Constructor Details
#initialize(id, type, accessories) ⇒ Metadata
Returns a new instance of Metadata.
133 134 135 136 137 138 |
# 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 |
Instance Attribute Details
#accessories ⇒ Object (readonly)
Returns the value of attribute accessories.
128 129 130 |
# File 'lib/cryptopunks/structs.rb', line 128 def accessories @accessories end |
#birthday ⇒ Object (readonly)
Returns the value of attribute birthday.
128 129 130 |
# File 'lib/cryptopunks/structs.rb', line 128 def birthday @birthday end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
128 129 130 |
# File 'lib/cryptopunks/structs.rb', line 128 def id @id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
128 129 130 |
# File 'lib/cryptopunks/structs.rb', line 128 def type @type end |
Instance Method Details
#alien? ⇒ Boolean
convenience helpers for “classic” (5) types
144 |
# File 'lib/cryptopunks/structs.rb', line 144 def alien?() is_type?( 'Alien'); end |
#ape? ⇒ Boolean
145 |
# File 'lib/cryptopunks/structs.rb', line 145 def ape?() is_type?( 'Ape' ); end |
#female? ⇒ Boolean
147 |
# File 'lib/cryptopunks/structs.rb', line 147 def female?() is_type?( 'Female' ); end |
#has_attribute?(name) ⇒ Boolean Also known as: has?, include?
convenience helpers to lookup attributes
151 152 153 154 155 156 |
# 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) ⇒ Boolean Also known as: is?
140 |
# File 'lib/cryptopunks/structs.rb', line 140 def is_type?( name ) @type.name == name; end |
#male? ⇒ Boolean
148 |
# File 'lib/cryptopunks/structs.rb', line 148 def male?() is_type?( 'Male' ); end |
#zombie? ⇒ Boolean
146 |
# File 'lib/cryptopunks/structs.rb', line 146 def zombie?() is_type?( 'Zombie' ); end |