Class: Jbuilder::DependencyTracker
- Inherits:
-
Object
- Object
- Jbuilder::DependencyTracker
- Defined in:
- lib/jbuilder/jbuilder_dependency_tracker.rb
Constant Summary collapse
- EXPLICIT_DEPENDENCY =
/# Template Dependency: (\S+)/
- DIRECT_RENDERS =
Matches:
json.partial! "messages/message" json.partial!('messages/message')
/ \w+\.partial! # json.partial! \(?\s* # optional parenthesis (['"])([^'"]+)\1 # quoted value /x
- INDIRECT_RENDERS =
Matches:
json.partial! partial: "comments/comment" json.comments @post.comments, partial: "comments/comment", as: :comment json.array! @posts, partial: "posts/post", as: :post = render partial: "account"
/ (?::partial\s*=>|partial:) # partial: or :partial => \s* # optional whitespace (['"])([^'"]+)\1 # quoted value /x
Class Method Summary collapse
Instance Method Summary collapse
- #dependencies ⇒ Object
-
#initialize(name, template, view_paths = nil) ⇒ DependencyTracker
constructor
A new instance of DependencyTracker.
Constructor Details
#initialize(name, template, view_paths = nil) ⇒ DependencyTracker
Returns a new instance of DependencyTracker.
30 31 32 |
# File 'lib/jbuilder/jbuilder_dependency_tracker.rb', line 30 def initialize(name, template, view_paths = nil) @name, @template, @view_paths = name, template, view_paths end |
Class Method Details
.call(name, template, view_paths = nil) ⇒ Object
26 27 28 |
# File 'lib/jbuilder/jbuilder_dependency_tracker.rb', line 26 def self.call(name, template, view_paths = nil) new(name, template, view_paths).dependencies end |
Instance Method Details
#dependencies ⇒ Object
34 35 36 |
# File 'lib/jbuilder/jbuilder_dependency_tracker.rb', line 34 def dependencies direct_dependencies + indirect_dependencies + explicit_dependencies end |