class Cryptopunks::Metadata::Accessory

nested class

Attributes

limit[R]
name[R]
type[R]

Public Class Methods

all() click to toggle source
# File lib/cryptopunks/structs.rb, line 118
def self.all() registry.values; end
build() click to toggle source
# File lib/cryptopunks/structs.rb, line 103
def self.build
  AccessoryType.all.reduce( {} ) do |h, type|
                                   type.accessories.each do |acc|
                                     h[ acc.name.downcase ] = acc
                                   end
                                   h
                                 end
end
find( q ) click to toggle source
# File lib/cryptopunks/structs.rb, line 120
def self.find( q ) registry[ q.to_s.downcase ]; end
new( name, type, limit ) click to toggle source
# File lib/cryptopunks/structs.rb, line 90
def initialize( name, type, limit )
  @name  = name
  @type  = type
  @limit = limit
end
registry() click to toggle source
# File lib/cryptopunks/structs.rb, line 112
def self.registry
  ## auto-build registry (hash table) lookup (by name)
  @@types ||= build
  @@types
end

Public Instance Methods

inspect() click to toggle source
# File lib/cryptopunks/structs.rb, line 97
def inspect
  %Q{<Accessory "#{@name}", type: "#{@type.name}", limit: #{@limit}>}
end