Sha256: 7357667d429dbc7c721167df153e6b1db8192829ec659de1ab1e9aa3892a56c6
Contents?: true
Size: 976 Bytes
Versions: 4
Compression:
Stored size: 976 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 crumb buoy def buoys @buoys ||= {} end def loaded_times @loaded_times ||= [] end def load_buoys_files return unless need_reload? buoys.clear loaded_times.clear buoy_files.each do |file| instance_eval open(file).read, file loaded_times << File.mtime(file) end end def buoy_files Dir[*Buoys.buoy_file_paths] end def need_reload? return true if buoys.empty? Rails.env.development? && loaded_times != buoy_files.map {|f| File.mtime(f) } end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
buoys-0.6.0 | lib/buoys/loader.rb |
buoys-0.5.0 | lib/buoys/loader.rb |
buoys-0.4.0 | lib/buoys/loader.rb |
buoys-0.3.0 | lib/buoys/loader.rb |