css-classes 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cc0420339b766bde5d4f7d57a49c606106c60027
4
+ data.tar.gz: 9d361ce9b95b02de8c5fb29d3415df5a7b8027ca
5
+ SHA512:
6
+ metadata.gz: 7af5090462fe02d0f31940abb21a079d4bb82380f205d80474e6a925aec8f3e4a97463739ed92fa4f8aeb795d52657587f0511982f61a2c8c557a4bc0991f4c7
7
+ data.tar.gz: fcb91cffb0eac2ea3e0c10db380e7b24563103c4b8bbf519c5172228b1dd47ce6025ac906a1e3c2823b224fc93eb10ca79bc17dd03d086bc57c2035e2635fe6b
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ .bundle/
2
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,53 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ css-classes (0.0.1)
5
+ activesupport (~> 4.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (4.2.5.1)
11
+ i18n (~> 0.7)
12
+ json (~> 1.7, >= 1.7.7)
13
+ minitest (~> 5.1)
14
+ thread_safe (~> 0.3, >= 0.3.4)
15
+ tzinfo (~> 1.1)
16
+ coderay (1.1.1)
17
+ diff-lcs (1.2.5)
18
+ i18n (0.7.0)
19
+ json (1.8.3)
20
+ method_source (0.8.2)
21
+ minitest (5.8.4)
22
+ pry (0.10.3)
23
+ coderay (~> 1.1.0)
24
+ method_source (~> 0.8.1)
25
+ slop (~> 3.4)
26
+ rspec (3.4.0)
27
+ rspec-core (~> 3.4.0)
28
+ rspec-expectations (~> 3.4.0)
29
+ rspec-mocks (~> 3.4.0)
30
+ rspec-core (3.4.4)
31
+ rspec-support (~> 3.4.0)
32
+ rspec-expectations (3.4.0)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.4.0)
35
+ rspec-mocks (3.4.1)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.4.0)
38
+ rspec-support (3.4.1)
39
+ slop (3.6.0)
40
+ thread_safe (0.3.5)
41
+ tzinfo (1.2.2)
42
+ thread_safe (~> 0.1)
43
+
44
+ PLATFORMS
45
+ ruby
46
+
47
+ DEPENDENCIES
48
+ css-classes!
49
+ pry (~> 0.10)
50
+ rspec (~> 3.4)
51
+
52
+ BUNDLED WITH
53
+ 1.11.2
data/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # CSS Classes
2
+
3
+ A super simple gem for Rails to add a `css_classes` helper method which makes it easy to set a list of nicely formatted, dasherized class names.
4
+
5
+ ```ruby
6
+ css_classes "foo", "bar_baz", "Box" # => "foo bar-baz box"
7
+ ```
@@ -0,0 +1,20 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "css-classes"
5
+ s.version = "0.0.1"
6
+ s.authors = ["Damien Timewell"]
7
+ s.email = ["mail@damientimewell.com"]
8
+ s.licenses = ['MIT']
9
+ s.homepage = "https://github.com/idlefingers/css-classes"
10
+ s.summary = "A tiny rails helper to make an array of strings into nice css classes"
11
+ s.description = ""
12
+
13
+ s.add_dependency 'activesupport', '~> 4.2'
14
+
15
+ s.add_development_dependency "rspec", '~> 3.4'
16
+ s.add_development_dependency "pry", '~> 0.10'
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- spec/*`.split("\n")
20
+ end
@@ -0,0 +1,4 @@
1
+ require 'active_support/core_ext/string'
2
+
3
+ require 'css-classes/helpers'
4
+ require 'css_classes/railtie' if defined?(Rails)
@@ -0,0 +1,9 @@
1
+ module CssClasses
2
+ module Helpers
3
+
4
+ def css_classes(*args)
5
+ args.compact.join(" ").dasherize.downcase
6
+ end
7
+
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module CssClasses
2
+ class Railtie < Rails::Railtie
3
+ initializer "css_classes.view_helpers" do
4
+ ActionView::Base.send :include, Helpers
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe "css_classes" do
4
+
5
+ it "should split classes with a space" do
6
+ expect(css_classes("foo", "bar")).to eq "foo bar"
7
+ end
8
+
9
+ it "should dasherize snake case words" do
10
+ expect(css_classes("foo", "bar_baz")).to eq "foo bar-baz"
11
+ end
12
+
13
+ it "should not change multi-word strings" do
14
+ expect(css_classes("foo", "bar baz")).to eq "foo bar baz"
15
+ end
16
+
17
+ it "should downcase strings" do
18
+ expect(css_classes("FOO", "BAR")).to eq "foo bar"
19
+ end
20
+
21
+ it "should compact nils" do
22
+ expect(css_classes("foo", nil, "bar")).to eq "foo bar"
23
+ end
24
+
25
+ end
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'pry'
4
+ require 'css-classes'
5
+
6
+ RSpec.configure do |config|
7
+ config.include CssClasses::Helpers
8
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: css-classes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Damien Timewell
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-04-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.4'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.10'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.10'
55
+ description: ''
56
+ email:
57
+ - mail@damientimewell.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - Gemfile
65
+ - Gemfile.lock
66
+ - README.md
67
+ - css-classes.gemspec
68
+ - lib/css-classes.rb
69
+ - lib/css-classes/helpers.rb
70
+ - lib/css-classes/railtie.rb
71
+ - spec/css-classes/helpers_spec.rb
72
+ - spec/spec_helper.rb
73
+ homepage: https://github.com/idlefingers/css-classes
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.5.1
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: A tiny rails helper to make an array of strings into nice css classes
97
+ test_files:
98
+ - spec/css-classes/helpers_spec.rb
99
+ - spec/spec_helper.rb