Sha256: 3d4e7e73eeb0ecbbc95a7452fa5a87af14e51a9df9692ec9b9c21e4a57344c49
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
require 'cheeba/version' require 'cheeba/reader' require 'cheeba/writer' require 'cheeba/indicators' require 'cheeba/defaults' module Cheeba DOTFILE = "#{ENV['HOME']}/.cheeba" # # File to Hash or Array # def self.read(input, options = {}) Cheeba::Reader.read(input, self.options(options)) end # # Hash or Array to .cash Array # def self.parse(object, options = {}) Cheeba::Writer.build(object, self.options(options)) end # # Hash or Array to .cash-file, e.g. filename.cash # def self.write(object, filename, options = {}) Cheeba::Writer.write(object, filename, self.options(options)) end # # writes a .cheeba file HOME, merges with options if :dot is true # def self.dotfile(home = ENV['HOME']) Cheeba::Writer.dotfile(Cheeba::Defaults.options, home) end private # # options # def self.options(options = {}) opt = Cheeba::Defaults.options.merge(Cheeba::Indicators.options.merge(options)) dot_opt = File.exists?(DOTFILE) ? Cheeba::Reader.read(DOTFILE, opt.merge({:symbolize_keys => true})) : nil unless opt[:dot] opt = opt.merge(dot_opt) if (dot_opt && dot_opt[:dot]) end opt end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cheeba-1.1.0 | lib/cheeba.rb |