Module: RatPack

Defined in:
lib/ratpack/date_time_helpers.rb,
lib/ratpack.rb,
lib/ratpack/tag.rb,
lib/ratpack/forms.rb,
lib/ratpack/routes.rb,
lib/ratpack/html_helpers.rb

Overview

Provides a number of methods for displaying and dealing with dates and times

Parts were strongly based on ar-code.svn.engineyard.com/plugins/relative_time_helpers/, and active_support

The key methods are relative_date, relative_date_span, and relative_time_span. This also gives you the Rails style Time DSL for working with numbers eg. 3.months.ago or 5.days.until(1.year.from_now)

Defined Under Namespace

Modules: DateAndTime, Forms, HtmlHelpers, Routes, Tag

Constant Summary collapse

VERSION =
'0.2.2'
LIBPATH =
::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
PATH =
::File.dirname(LIBPATH) + ::File::SEPARATOR

Class Method Summary collapse

Class Method Details

.libpath(*args) ⇒ Object



13
14
15
# File 'lib/ratpack.rb', line 13

def self.libpath( *args )
  args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
end

.path(*args) ⇒ Object



17
18
19
# File 'lib/ratpack.rb', line 17

def self.path( *args )
  args.empty? ? PATH : ::File.join(PATH, args.flatten)
end

.require_all_libs_relative_to(fname, dir = nil) ⇒ Object



21
22
23
24
25
26
# File 'lib/ratpack.rb', line 21

def self.require_all_libs_relative_to( fname, dir = nil )
  dir ||= ::File.basename(fname, '.*')
  search_me = ::File.expand_path(
      ::File.join(::File.dirname(fname), dir, '**', '*.rb'))
  Dir.glob(search_me).sort.each {|rb| require rb }
end

.versionObject



9
10
11
# File 'lib/ratpack.rb', line 9

def self.version
  VERSION
end