lib/dnote.rb in dnote-1.3.0 vs lib/dnote.rb in dnote-1.3.1

- old
+ new

@@ -1,32 +1,27 @@ +require 'yaml' + module DNote - VERSION = "1.2.1" #:till: VERSION = "<%= version %>" + DIRECTORY = File.dirname(__FILE__) + '/dnote' - require 'dnote/session' + profile = YAML.load(File.new(DIRECTORY + '/profile.yml')) + verfile = YAML.load(File.new(DIRECTORY + '/version.yml')) - # NOTE: Toying with the idea of making DNote a class. + VERSION = verfile.values_at('major','minor','patch','state','build').compact.join('.') - #attr :notes # - #def initialize(paths, options={}) - # labels = options[:labels] || options['labels'] - # @notes = Notes.new(paths, labels) - #end - # - # - #def save(format, output, options) - # options = options.merge({ :format=>format, :output=>output }) - # format = Format.new(notes, options) - # format.render - #end - # - # - #def display(format, options) - # options = options.merge({ :format=>format, :output=>nil }) - # format = Format.new(@notes, options) - # format.render - #end - + def self.const_missing(name) + key = name.to_s.downcase + if verfile.key?(key) + verfile[key] + elsif profile.key?(key) + profile[key] + else + super(name) + end + end end + +require 'dnote/session' # TEST: This is a test of arbitraty labels.