Spec-Zone.ru › Ruby on Rails 5.1

класс ActiveSupport::InheritableOptions

Родитель:
ActiveSupport::OrderedOptions

InheritableOptions предоставляет конструктор для создания OrderedOptions хэша, унаследованного от другого хэша.

Используйте этот метод, если у вас уже есть хэш, и вы хотите создать новый на его основе.

h = ActiveSupport::InheritableOptions.new({ girl: 'Mary', boy: 'John' })
h.girl # => 'Mary'
h.boy  # => 'John'

Публичные методы класса

new(parent = nil) Показать исходный код
# File activesupport/lib/active_support/ordered_options.rb, line 68
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
Вызывает метод суперкласса

Публичные методы экземпляра

inheritable_copy() Показать исходный код
# File activesupport/lib/active_support/ordered_options.rb, line 79
def inheritable_copy
  self.class.new(self)
end

© 2004–2018 David Heinemeier Hansson
Licensed under the MIT License.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API