Class: Cryptopunks::Metadata::Type
- Inherits:
-
Object
- Object
- Cryptopunks::Metadata::Type
- Defined in:
- lib/cryptopunks/structs.rb
Overview
nested class
Instance Attribute Summary collapse
-
#limit ⇒ Object
readonly
todo/check: use alias family or such?.
-
#name ⇒ Object
readonly
todo/check: use alias family or such?.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, limit) ⇒ Type
constructor
A new instance of Type.
-
#inspect ⇒ Object
def to_s() @name; end.
Constructor Details
#initialize(name, limit) ⇒ Type
Returns a new instance of Type.
14 15 16 17 |
# File 'lib/cryptopunks/structs.rb', line 14 def initialize( name, limit ) @name = name @limit = limit end |
Instance Attribute Details
#limit ⇒ Object (readonly)
todo/check: use alias family or such?
12 13 14 |
# File 'lib/cryptopunks/structs.rb', line 12 def limit @limit end |
#name ⇒ Object (readonly)
todo/check: use alias family or such?
12 13 14 |
# File 'lib/cryptopunks/structs.rb', line 12 def name @name end |
Class Method Details
.all ⇒ Object
40 |
# File 'lib/cryptopunks/structs.rb', line 40 def self.all() registry.values; end |
.build ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/cryptopunks/structs.rb', line 26 def self.build TYPES.reduce( {} ) do |h, rec| type = Type.new( rec[:name], rec[:limit ] ) h[ rec[:name].downcase ] = type h end end |
.find(q) ⇒ Object
42 |
# File 'lib/cryptopunks/structs.rb', line 42 def self.find( q ) registry[ q.to_s.downcase ]; end |
.registry ⇒ Object
34 35 36 37 38 |
# File 'lib/cryptopunks/structs.rb', line 34 def self.registry ## auto-build registry (hash table) lookup (by name) @@types ||= build @@types end |
Instance Method Details
#inspect ⇒ Object
def to_s() @name; end
20 21 22 |
# File 'lib/cryptopunks/structs.rb', line 20 def inspect %Q{<Type "#{@name}", limit: #{@limit}>} end |