lib/pakyow/presenter/views/partial.rb in pakyow-presenter-1.0.0.rc2 vs lib/pakyow/presenter/views/partial.rb in pakyow-presenter-1.0.0.rc3

- old
+ new

@@ -1,28 +1,30 @@ # frozen_string_literal: true module Pakyow module Presenter - class Partial < View - attr_accessor :name + module Views + class Partial < View + attr_accessor :name - class << self - def load(path, content: nil, **args) - name = File.basename(path, ".*") - name = name[1..-1] if name.start_with?("_") - self.new(name.to_sym, content || File.read(path), **args) - end + class << self + def load(path, content: nil, **args) + name = File.basename(path, ".*") + name = name[1..-1] if name.start_with?("_") + self.new(name.to_sym, content || File.read(path), **args) + end - def from_object(name, object) - super(object).tap do |instance| - instance.instance_variable_set(:@name, name) + def from_object(name, object) + super(object).tap do |instance| + instance.instance_variable_set(:@name, name) + end end end - end - def initialize(name, html = "", **args) - @name = name - super(html, **args) + def initialize(name, html = "", **args) + @name = name + super(html, **args) + end end end end end