added natural sorting gem

This commit is contained in:
Scott Davis 2012-03-21 12:40:24 -04:00
parent df8c987a5f
commit 80658a300e
2 changed files with 4 additions and 1 deletions

View File

@ -16,6 +16,7 @@ Gem::Specification.new do |gem|
gem.version = Attentive::VERSION gem.version = Attentive::VERSION
gem.add_dependency 'sinatra' gem.add_dependency 'sinatra'
gem.add_dependency 'naturalsort', '~> 1.1.1'
gem.add_dependency 'sprockets' gem.add_dependency 'sprockets'
gem.add_dependency 'sprockets-vendor_gems' gem.add_dependency 'sprockets-vendor_gems'

View File

@ -13,6 +13,8 @@ require 'rack/builder'
require 'forwardable' require 'forwardable'
require 'natural_sort_kernel'
module Attentive module Attentive
module Helpers module Helpers
def image_path(path, options) def image_path(path, options)
@ -147,7 +149,7 @@ module Attentive
def slides def slides
slides = [] slides = []
Dir['presentation/*.slides'].sort.each do |file| Dir['presentation/*.slides'].natural_sort.each do |file|
File.readlines(file).each do |line| File.readlines(file).each do |line|
if line[%r{^!SLIDE}] if line[%r{^!SLIDE}]
slides << Slide.new(:classes => line.split(' ')[1..-1]) slides << Slide.new(:classes => line.split(' ')[1..-1])