module CSL::InheritsNameOptions

Public Instance Methods

inherits(name) click to toggle source
# File lib/csl/name_options.rb, line 24
def inherits(name)
  inheritable_options = "inheritable_#{name}".to_sym

  define_method("inherited_#{name}") do |node, style|
    options = {}

    if node.respond_to?(inheritable_options)
      options = node.send(inheritable_options).merge(options)
    end

    style ||= root

    if !style.equal?(self) && style.respond_to?(inheritable_options)
      options = style.send(inheritable_options).merge(options)
    end

    options
  end
end