Sha256: 01ac864d73944e8b80612430affab18bd3b9dac627a690758dbfdabaea7e19a1

Contents?: true

Size: 660 Bytes

Versions: 2

Compression:

Stored size: 660 Bytes

Contents

module Buoys
  class Loader
    class << self
      #
      # buoy :account do
      #   link 'Account', account_path
      # end
      #
      # buoy :account_edit do |account|
      #   link 'Account Edit', edit_account_path(account)
      #   pre_buoy :account
      # end
      def buoy(key, &block)
        buoys[key] = block
      end
      alias_method :crumb, :buoy

      def buoys
        @buoys ||= {}
      end

      def load_buoys_files
        buoys.clear

        buoy_files.each do |file|
          instance_eval open(file).read, file
        end
      end

      def buoy_files
        Dir[*Buoys.buoy_file_paths]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
buoys-0.2.0 lib/buoys/loader.rb
buoys-0.1.0 lib/buoys/loader.rb