classnames-rails-view 0.1.1 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c127f26fc7323618c20652f339983cd576ca0875
4
- data.tar.gz: 9e3b2ad645947a4503f5ac9b779208793034bd1a
2
+ SHA256:
3
+ metadata.gz: f7b68268254790e28a671f42b1e53698404e6116101d6ff745dd25c12675fe09
4
+ data.tar.gz: ff3f340df7174a36772d8abcea984b296803da59d632d2cf88713cd5835d1a4c
5
5
  SHA512:
6
- metadata.gz: 6d1ada91c0d4722bb0599f4edb8f519d2cb9d5e7c1a4c85f1ffefb92d480c12735afbb7369a345661df00f179c8baa18d999cead329723a833018b89f1c3992b
7
- data.tar.gz: 9b4e306e81b59e05428572c89011cef978f4782df36aaff7c6695a204e682a8d32b6000cf4f145be03172ca06f2abb79f1d738f6d1a02564f6c269187f06041d
6
+ metadata.gz: dfdf1f88525e72f69455c2e507dfc4dcfd4db18a82b384d24344c0e775be292581893594273d4957da22ce6cf6c72632f8a0d6c3f05315799438f61e54cd6e13
7
+ data.tar.gz: a49c0fe626d5ac42789bd4ee3000b8facc28cab34035c4d028b33e418dd2d3405d293d2e83d0da3f5092195569659db4b26f1ecc105715e1e3508998eb2b0fe5
data/README.md CHANGED
@@ -6,33 +6,33 @@ This is a view helper that dynamically generates class attributes in Rails view,
6
6
  The Helper method is included automatically, so you can use it immediately.
7
7
 
8
8
  ```erb
9
- <div class="<%= classNames('foo') %>">Hello World</div>
9
+ <div class="<%= class_names('foo') %>">Hello World</div>
10
10
  <%# <div class="foo">Hello World</div> %>
11
11
  ```
12
12
 
13
- The `classNames` method takes any number of arguments which can be a string or hash.
13
+ The `class_names` method takes any number of arguments which can be a string or hash.
14
14
  The argument `'foo'` is short for `{ foo: true }`. If the value associated with a given key is falsy, that key won't be included in the output.
15
15
 
16
16
  ```js
17
- classNames('foo', 'bar'); // => 'foo bar'
18
- classNames('foo', { bar: true }); // => 'foo bar'
19
- classNames({ 'foo-bar': true }); // => 'foo-bar'
20
- classNames({ 'foo-bar': false }); // => ''
21
- classNames({ foo: true }, { bar: true }); // => 'foo bar'
22
- classNames({ foo: true, bar: true }); // => 'foo bar'
17
+ class_names('foo', 'bar'); // => 'foo bar'
18
+ class_names('foo', { bar: true }); // => 'foo bar'
19
+ class_names({ 'foo-bar': true }); // => 'foo-bar'
20
+ class_names({ 'foo-bar': false }); // => ''
21
+ class_names({ foo: true }, { bar: true }); // => 'foo bar'
22
+ class_names({ foo: true, bar: true }); // => 'foo bar'
23
23
 
24
24
  // lots of arguments of various types
25
- classNames('foo', { bar: true, duck: false }, 'baz', { quux: true }); // => 'foo bar baz quux'
25
+ class_names('foo', { bar: true, duck: false }, 'baz', { quux: true }); // => 'foo bar baz quux'
26
26
 
27
27
  // other falsy values are just ignored
28
- classNames(null, false, 'bar', undefined, 0, 1, { baz: null }, ''); // => 'bar 1'
28
+ class_names(null, false, 'bar', undefined, 0, 1, { baz: null }, ''); // => 'bar 1'
29
29
  ```
30
30
 
31
31
  Arrays will be recursively flattened as per the rules above:
32
32
 
33
33
  ```js
34
34
  var arr = ['b', { c: true, d: false }];
35
- classNames('a', arr); // => 'a b c'
35
+ class_names('a', arr); // => 'a b c'
36
36
  ```
37
37
 
38
38
  ### Change the method name
@@ -0,0 +1 @@
1
+ require 'classnames/rails/view'
@@ -3,7 +3,7 @@ module Classnames
3
3
  module View
4
4
  class Railtie < ::Rails::Railtie
5
5
  config.classnames_rails_view = ActiveSupport::OrderedOptions.new
6
- config.classnames_rails_view.method_name = :classNames
6
+ config.classnames_rails_view.method_name = :class_names
7
7
 
8
8
  config.after_initialize do |_app|
9
9
  require 'classnames/rails/view/action_view'
@@ -1,7 +1,7 @@
1
1
  module Classnames
2
2
  module Rails
3
3
  module View
4
- VERSION = '0.1.1'.freeze
4
+ VERSION = '1.1.1'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: classnames-rails-view
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masamoto Miyata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-27 00:00:00.000000000 Z
11
+ date: 2021-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '5.0'
20
+ - - "<="
18
21
  - !ruby/object:Gem::Version
19
- version: 5.1.4
22
+ version: '6.1'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '5.0'
30
+ - - "<="
25
31
  - !ruby/object:Gem::Version
26
- version: 5.1.4
32
+ version: '6.1'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: pry-byebug
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -133,6 +139,7 @@ files:
133
139
  - MIT-LICENSE
134
140
  - README.md
135
141
  - Rakefile
142
+ - lib/classnames-rails-view.rb
136
143
  - lib/classnames/rails/view.rb
137
144
  - lib/classnames/rails/view/action_view.rb
138
145
  - lib/classnames/rails/view/core.rb
@@ -158,8 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
165
  - !ruby/object:Gem::Version
159
166
  version: '0'
160
167
  requirements: []
161
- rubyforge_project:
162
- rubygems_version: 2.6.14
168
+ rubygems_version: 3.0.6
163
169
  signing_key:
164
170
  specification_version: 4
165
171
  summary: The helper method to dynamically generate class attribute of HTML tag.