Sha256: b65e3e57ce03053ddb50fde2de7b56c7377159e96b5012336b88fd208bccf0a3

Contents?: true

Size: 350 Bytes

Versions: 1

Compression:

Stored size: 350 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?
      text.scan(/(=\s*|\bh\.|\bhelpers\.)section(\(|\s+)['":]([\w\/]+)/).map(&:last).sort.uniq
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sections_rails-0.11.0 lib/sections_rails/partial_parser.rb