Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more

In Files

  • rss/utils.rb

Class/Module Index [+]

Quicksearch

RSS::Utils::InheritedReader

Public Instance Methods

inherited_array_reader(constant_name) click to toggle source
 
               # File rss/utils.rb, line 98
def inherited_array_reader(constant_name)
  inherited_reader(constant_name) do |result, current|
    current + result
  end
end
            
inherited_hash_reader(constant_name) click to toggle source
 
               # File rss/utils.rb, line 104
def inherited_hash_reader(constant_name)
  inherited_reader(constant_name) do |result, current|
    result.merge(current)
  end
end
            
inherited_reader(constant_name) click to toggle source
 
               # File rss/utils.rb, line 82
def inherited_reader(constant_name)
  base_class = inherited_base
  result = base_class.const_get(constant_name)
  found_base_class = false
  ancestors.reverse_each do |klass|
    if found_base_class
      if klass.const_defined?(constant_name)
        result = yield(result, klass.const_get(constant_name))
      end
    else
      found_base_class = klass == base_class
    end
  end
  result
end