Sha256: 7a7111669396aae2e3f97e36d7f8091e15e3b1a94f3844a87af1af9245f599b8

Contents?: true

Size: 519 Bytes

Versions: 1

Compression:

Stored size: 519 Bytes

Contents

require 'populus/do'
require 'populus/watch/node'

module Populus
  module DSL
    def watch(arg, &b)
      watching = find_watch_obj(arg)
      watching.instance_eval(&b)
      Do.register_object watching
    end

    def find_watch_obj(arg)
      const = arg.gsub(/(^.|_.)/) {|c| c.tr('_', '').upcase }
      Watch.const_get(const).new
    end

    def eval_setting(path)
      load path
    rescue => e
      STDERR.puts "Invalid setting format! #{path}", "error is:", e
      exit 1
    end
  end

  extend DSL
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
populus-0.0.1.pre3 lib/populus/dsl.rb