Class: ActivityLogger
- Inherits:
-
Object
- Object
- ActivityLogger
- Includes:
- Library, RXFileIOModule
- Defined in:
- lib/activity-logger.rb
Instance Method Summary collapse
- #create(desc = '', time = Time.now, id: id=nil) ⇒ Object
-
#initialize(dirpath = nil, dir: dirpath, xsl_path: nil, config: nil) ⇒ ActivityLogger
constructor
A new instance of ActivityLogger.
Methods included from Library
Constructor Details
#initialize(dirpath = nil, dir: dirpath, xsl_path: nil, config: nil) ⇒ ActivityLogger
Returns a new instance of ActivityLogger.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/activity-logger.rb', line 24 def initialize(dirpath=nil, dir: dirpath, xsl_path: nil, config: nil) @publish_html = false if config then h = SimpleConfig.new(config).to_h dir, @urlbase, @edit_url, @css_url, xsl = \ %i(dir urlbase edit_url css_url xsl_path).map{|x| h[x]} @xsl_path = xsl_path || xsl @publish_html = true end Dir.chdir(dir) if dir end |
Instance Method Details
#create(desc = '', time = Time.now, id: id=nil) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/activity-logger.rb', line 41 def create(desc='', time=Time.now, id: id=nil) ddaily = DynarexDaily.new(nil, xslt: @xsl_path) ddaily.create(time: time.to_s, desc: desc, id: id) ddaily.save if @publish_html then File.write 'index.txt', ddaily.to_s save_html() end end |