Module: Shi::Tools
- Defined in:
- lib/shi/tools/version.rb,
lib/shi/tools.rb
Constant Summary collapse
- VERSION =
"0.2.0"
Class Method Summary collapse
Class Method Details
.coalesce(*args) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/shi/tools.rb', line 6 def coalesce *args args.each do |arg| return arg unless arg.nil? end nil end |
.lookup_with(source, name, prefixes) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/shi/tools.rb', line 13 def lookup_with source, name, prefixes prefixes.each do |prefix| name_with_prefix = if prefix == :base name else prefix.to_s + '.' + name end value = source[name_with_prefix] return value unless value.nil? end nil end |