Sha256: 96d3fe516454efd3acd3d785b2b839f7a2ac5e93574f828db4dc22aaa0455a8b
Contents?: true
Size: 1.16 KB
Versions: 5
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
5 entries across 5 versions & 2 rubygems
Version | Path |
---|---|
awesome-cheeba-1.0.1 | lib/cheeba.rb |
awesome-cheeba-1.0.2 | lib/cheeba.rb |
awesome-cheeba-1.0.3 | lib/cheeba.rb |
awesome-cheeba-1.0.4 | lib/cheeba.rb |
cheeba-1.0.4 | lib/cheeba.rb |