Skip to content

Commit

Permalink
Reimplement the DeferredRender module (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephannv authored Oct 15, 2024
1 parent 111e2ff commit 7baa0cc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ gemspec
gem "benchmark-ips", "2.14.0"
gem "minitest", "5.22.3"
gem "rake", "13.2.1"
gem "phlex", github: "phlex-ruby/phlex"
gem "standard", "1.35.1"
9 changes: 8 additions & 1 deletion lib/phlex/slotable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@

module Phlex
module Slotable
module DeferredRender
def before_template(&)
vanish(&)
super
end
end

def self.included(base)
base.extend(ClassMethods)
end

module ClassMethods
def slot(slot_name, callable = nil, types: nil, collection: false)
include Phlex::DeferredRender
include DeferredRender

if types
types.each do |type, callable|
Expand Down
2 changes: 1 addition & 1 deletion phlex-slotable.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]

# Uncomment to register a new dependency of your gem
spec.add_dependency "phlex", ">= 1.9", "< 3"
# spec.add_dependency "phlex", ">= 1.9", "< 3"

# For more information and examples about making a new gem, check out our
# guide at: https://bundler.io/guides/creating_gem.html
Expand Down

0 comments on commit 7baa0cc

Please sign in to comment.