Module: Carioca::Helpers
- Included in:
- Configuration, Registry, Services::Config::Settings
- Defined in:
- lib/carioca/helpers.rb
Instance Method Summary collapse
- #debug(message:) ⇒ Object
- #i18n ⇒ Object
- #log ⇒ Object
-
#search_file_in_gem(gem, file) ⇒ String, False
facility to find a file in gem path.
Instance Method Details
#debug(message:) ⇒ Object
13 14 15 |
# File 'lib/carioca/helpers.rb', line 13 def debug(message:) log.debug(config.name) { .to_s } end |
#i18n ⇒ Object
9 10 11 |
# File 'lib/carioca/helpers.rb', line 9 def i18n get_service name: :i18n end |
#log ⇒ Object
5 6 7 |
# File 'lib/carioca/helpers.rb', line 5 def log get_service name: :logger end |
#search_file_in_gem(gem, file) ⇒ String, False
facility to find a file in gem path
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/carioca/helpers.rb', line 22 def search_file_in_gem(gem, file) if Gem::Specification.respond_to?(:find_by_name) begin spec = Gem::Specification.find_by_name(gem) rescue LoadError spec = nil end else spec = Gem.searcher.find(gem) end if spec res = if Gem::Specification.respond_to?(:find_by_name) spec.lib_dirs_glob.split('/') else Gem.searcher.lib_dirs_for(spec).split('/') end res.pop services_path = res.join('/').concat("/#{file}") return services_path if File.exist?(services_path) end false end |