wordnik_ruby_helpers 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in wordnik_ruby_helpers.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,3 @@
1
+ module WordnikRubyHelpers
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,22 @@
1
+ module WordnikRubyHelpers
2
+
3
+ # Give this helper an array, and get back a string of <li> elements.
4
+ # The first item gets a class of first and the last, well.. last.
5
+ # This makes it easier to apply CSS styles to lists, be they ordered or unordered.
6
+ # http://zeke.tumblr.com/post/98025647/a-nice-little-view-helper-for-generating-list-items
7
+ def convert_to_list_items(items, *args)
8
+ default_options = {:stripe => true}
9
+ options = default_options.merge(args.extract_options!)
10
+ out = []
11
+ items.each_with_index do |item, index|
12
+ css = []
13
+ css << "first" if items.first == item
14
+ css << "last" if items.last == item
15
+ css << "even" if options[:stripe] && index%2 == 1
16
+ css << "odd" if options[:stripe] && index%2 == 0 # (First item is odd (1))
17
+ out << content_tag(:li, item, :class => css.join(" "))
18
+ end
19
+ raw out.join("\n")
20
+ end
21
+
22
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "wordnik_ruby_helpers/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "wordnik_ruby_helpers"
7
+ s.version = WordnikRubyHelpers::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Zeke Sikelianos", "John McGrath"]
10
+ s.email = ["zeke@wordnik.com", "john@wordnik.com"]
11
+ s.homepage = "http://wordnik.com"
12
+ s.summary = %q{A handful of monkey patches and view helpers that we use in our ruby/rails projects}
13
+ s.description = %q{A handful of monkey patches and view helpers that we use in our ruby/rails projects}
14
+
15
+ s.rubyforge_project = "wordnik_ruby_helpers"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wordnik_ruby_helpers
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Zeke Sikelianos
13
+ - John McGrath
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-01-12 00:00:00 -08:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: A handful of monkey patches and view helpers that we use in our ruby/rails projects
23
+ email:
24
+ - zeke@wordnik.com
25
+ - john@wordnik.com
26
+ executables: []
27
+
28
+ extensions: []
29
+
30
+ extra_rdoc_files: []
31
+
32
+ files:
33
+ - .gitignore
34
+ - Gemfile
35
+ - Rakefile
36
+ - lib/wordnik_ruby_helpers.rb
37
+ - lib/wordnik_ruby_helpers/version.rb
38
+ - wordnik_ruby_helpers.gemspec
39
+ has_rdoc: true
40
+ homepage: http://wordnik.com
41
+ licenses: []
42
+
43
+ post_install_message:
44
+ rdoc_options: []
45
+
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ segments:
54
+ - 0
55
+ version: "0"
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ requirements: []
65
+
66
+ rubyforge_project: wordnik_ruby_helpers
67
+ rubygems_version: 1.3.7
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: A handful of monkey patches and view helpers that we use in our ruby/rails projects
71
+ test_files: []
72
+