Class: Yetty::Publisher
- Inherits:
-
Shelr::Publisher
- Object
- Shelr::Publisher
- Yetty::Publisher
- Defined in:
- lib/yetty/record.rb
Instance Attribute Summary collapse
-
#file_name ⇒ Object
readonly
Returns the value of attribute file_name.
Instance Method Summary collapse
- #dump_filename ⇒ Object
-
#initialize(file_name = 'yetty.json') ⇒ Publisher
constructor
A new instance of Publisher.
- #prepare(id) ⇒ Object
Constructor Details
#initialize(file_name = 'yetty.json') ⇒ Publisher
Returns a new instance of Publisher.
10 11 12 13 |
# File 'lib/yetty/record.rb', line 10 def initialize(file_name='yetty.json') @file_name = file_name super() end |
Instance Attribute Details
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
8 9 10 |
# File 'lib/yetty/record.rb', line 8 def file_name @file_name end |
Instance Method Details
#dump_filename ⇒ Object
31 32 33 |
# File 'lib/yetty/record.rb', line 31 def dump_filename file_name end |
#prepare(id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/yetty/record.rb', line 15 def prepare(id) out = {} ['meta', 'timing', 'typescript'].each do |file| out[file] = File.read(File.join(Shelr.data_dir(id), file)) end = JSON.parse(out.delete('meta')) .each { |k,v| out[k] = v } STDOUT.print 'Description: ' out['description'] = STDIN.gets.strip STDOUT.print 'Tags (ex: howto, linux): ' out['tags'] = STDIN.gets.strip out['private'] = @private return out.to_json end |