Class: CsvPack::Meta
- Inherits:
-
Object
- Object
- CsvPack::Meta
- Extended by:
- Forwardable
- Defined in:
- lib/csvpack/pack.rb
Overview
Pack(age) Meta / Manifest / Descriptor
Class Method Summary collapse
-
.load(text) ⇒ Object
todo: add alias method read.
- .load_file(path) ⇒ Object
Instance Method Summary collapse
-
#initialize(h) ⇒ Meta
constructor
A new instance of Meta.
- #license ⇒ Object
- #name ⇒ Object
- #pretty_print(printer) ⇒ Object
-
#resources ⇒ Object
todo/fix: wrap resource in a class - why? why not?.
- #title ⇒ Object
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
#license ⇒ Object
32 |
# File 'lib/csvpack/pack.rb', line 32 def license() @h['license']; end |
#name ⇒ Object
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 |
#resources ⇒ Object
todo/fix: wrap resource in a class - why? why not?
35 |
# File 'lib/csvpack/pack.rb', line 35 def resources() @h['resources']; end |
#title ⇒ Object
31 |
# File 'lib/csvpack/pack.rb', line 31 def title() @h['title']; end |