Sha256: 968069e8a75dcc7de8dae48032532cb286d817f20f58e1f730a3411a1f1e7034

Contents?: true

Size: 624 Bytes

Versions: 1

Compression:

Stored size: 624 Bytes

Contents

require "date"
require "writer/configuration"
require "writer/version"
require "writer/file_creator"

module Writer
  class << self
    def write!(name = nil, content = nil)
      name ||= default_filename
      FileCreator.create!(name, content)
    end

    def configure
      yield(config)
    end

    # attempt delegation to config
    def method_missing(name, *args)
      return config.send(name, *args)
      rescue
        super
    end

    private
    def default_filename
      date = Date.today
      date.strftime('%Y-%m%b-%d.md')
    end

    def config
      @config ||= Configuration.new
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
writer-0.0.4 lib/writer.rb