Sha256: f778c6a48b5a78d6326dffde7e494de52c247c077102a7ba94b745b2ecc8b331
Contents?: true
Size: 522 Bytes
Versions: 7
Compression:
Stored size: 522 Bytes
Contents
module SectionsRails module PartialParser # Returns a list of all section names in the given text. # # @param [ String ] text # @return [ Array<String> ] def self.find_sections text return [] if text.blank? # Find sections in ERB templates. result = text.scan(/<%=\s*section\s+['":]([^'",\s]+)/).flatten.sort.uniq # Find sections in HAML templates. result.concat text.scan(/^\s*\=\s*section\s+['":]([^'",\s]+)/).flatten.sort.uniq result end end end
Version data entries
7 entries across 7 versions & 1 rubygems