module Wardrobe::Plugins::HtmlInitializer::InstanceMethods

Public Class Methods

new(html = nil, **args) click to toggle source
Calls superclass method
# File lib/wardrobe/plugins/html_initializer.rb, line 22
def initialize(html = nil, **args)
  if html
    define_singleton_method(:_attribute_init) do |atr, doc, _name|
      value = atr.options[:html_selector].call(doc, atr, self)
      send(atr.setter_name, value)
    end
    html = HtmlInitializer.parse(html) if html.is_a?(String)
    _wardrobe_init(html)
  else
    super(**args)
  end
end