Sha256: d27ffe0c3bbc7968d4365ebdf8b7b5f985cc49b00f55dec39d580fe5aa9a4074

Contents?: true

Size: 476 Bytes

Versions: 1

Compression:

Stored size: 476 Bytes

Contents

# Returns a list of all section names in the given text.
def find_sections text
  result = text.scan(/<%=\s*section\s+['":]([^'",\s]+)/).flatten.sort.uniq
  result.concat text.scan(/^\s*\=\s*section\s+['":]([^'",\s]+)/).flatten.sort.uniq
  result
end


# Returns directory and filename portion of the given path.
def split_path paths
  segments = paths.split '/'
  directory = segments[0..-2].join('/')
  directory += '/' if directory.size > 0
  [directory, segments[-1]]
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sections_rails-0.6.1 lib/sections_rails/string_tools.rb