класс ActiveSupport::InheritableOptions
InheritableOptions предоставляет конструктор для создания OrderedOptions хэша, унаследованного от другого хэша.
Используйте этот метод, если у вас уже есть хэш, и вы хотите создать новый, основанный на нём.
h = ActiveSupport::InheritableOptions.new({ girl: 'Mary', boy: 'John' })
h.girl # => 'Mary'
h.boy # => 'John'
Публичные методы класса
# File activesupport/lib/active_support/ordered_options.rb, line 70
def initialize(parent = nil)
if parent.kind_of?(OrderedOptions)
# use the faster _get when dealing with OrderedOptions
super() { |h, k| parent._get(k) }
elsif parent
super() { |h, k| parent[k] }
else
super()
end
end Вызывает метод суперкласса
Публичные методы экземпляра
# File activesupport/lib/active_support/ordered_options.rb, line 81 def inheritable_copy self.class.new(self) end
© 2004–2018 David Heinemeier Hansson
Licensed under the MIT License.