class Cryptopunks::DesignSeries
todo/check:
find a better way to (auto?) include more designs?
Public Class Methods
build( dir )
click to toggle source
# File lib/cryptopunks/image.rb, line 14 def self.build( dir ) data = {} paths = Dir.glob( "#{dir}/**.txt" ) paths.each do |path| basename = File.basename( path, File.extname( path ) ) text = File.open( path, 'r:utf-8' ) { |f| f.read } ## todo/check: auto-parse "ahead of time" here ## or keep "raw" text - why? why not? data[ basename ] = text end data end
new( dir )
click to toggle source
# File lib/cryptopunks/image.rb, line 27 def initialize( dir ) @dir = dir # e.g. "#{Cryptopunks.root}/config/more" end
Public Instance Methods
[](key)
click to toggle source
# File lib/cryptopunks/image.rb, line 36 def [](key) data[ key ]; end
data()
click to toggle source
# File lib/cryptopunks/image.rb, line 31 def data ## note: lazy load / build on first demand only @data ||= self.class.build( @dir ) end
keys()
click to toggle source
# File lib/cryptopunks/image.rb, line 38 def keys() data.keys; end
size()
click to toggle source
# File lib/cryptopunks/image.rb, line 37 def size() data.size; end
to_h()
click to toggle source
# File lib/cryptopunks/image.rb, line 39 def to_h() data; end