Class: CsvPack::Meta

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/csvpack/pack.rb

Overview

Pack(age) Meta / Manifest / Descriptor

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(h) ⇒ Meta

Returns a new instance of Meta.



26
27
28
# File 'lib/csvpack/pack.rb', line 26

def initialize( h )
  @h = h
end

Class Method Details

.load(text) ⇒ Object

todo: add alias method read



19
20
21
22
# File 'lib/csvpack/pack.rb', line 19

def self.load( text )
  hash = JSON.parse( text )
  new( hash )
end

.load_file(path) ⇒ Object



13
14
15
16
# File 'lib/csvpack/pack.rb', line 13

def self.load_file( path )
  text = File.open( path, 'r:utf-8' ).read
  load( text )
end

Instance Method Details

#licenseObject



32
# File 'lib/csvpack/pack.rb', line 32

def license()   @h['license']; end

#nameObject



30
# File 'lib/csvpack/pack.rb', line 30

def name()      @h['name']; end

#pretty_print(printer) ⇒ Object



40
41
42
# File 'lib/csvpack/pack.rb', line 40

def pretty_print( printer )
  printer.text "Meta<#{object_id} @h.name=#{name}, ...>"
end

#resourcesObject

todo/fix: wrap resource in a class - why? why not?



35
# File 'lib/csvpack/pack.rb', line 35

def resources() @h['resources']; end

#titleObject



31
# File 'lib/csvpack/pack.rb', line 31

def title()     @h['title']; end