classnames-rails-view 0.1.3 → 1.0.0

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
2
  SHA256:
3
- metadata.gz: 93e4f68405abfd23a096ddf7454d171cf3d4a842e49f90f6778795c11390f515
4
- data.tar.gz: 1131a506fc35726c83131e5a4ae29ef4645b2df11f9b80fbcd6da7c76469b383
3
+ metadata.gz: 298692499e7c51bd97311568b503edf38e5a1f22c59c69a39d5f7a0035eb4abd
4
+ data.tar.gz: 3d853d8645dece5612773ea6305596d5ded20e13e2daa5d83df8e81dae330a38
5
5
  SHA512:
6
- metadata.gz: 67d396e0439f907887915e20abb45ce014285fb492c529c425569400c184e2005718b5ae48f30e2797c4ce43462f85adbbd8f0da98539ec1b8e8ac212a411138
7
- data.tar.gz: 3b3cec22ab7ff96299f57ecf9b0a8e0c05a7c7c861991eaa866bc86958ab45663b9f4f3c2c3afdb5767e5b3d53fce7fe52bd0be77510d8941897f1b79c01d3d7
6
+ metadata.gz: 84cebd452f5708e94660d76cfb22bb202aee75593f71fac95a2d9cc52a0d988dd8b40a01694ed118e6a65dcdb1ae4156baacfa701ebd2bdac881d4451946bef1
7
+ data.tar.gz: f1a608935661e77b1a5fed16f7001bab13a24b6e3337524dac6dea323da6bffc5f42ce72e400113a0b3c4c976237b8e0af0cd43c65e8e33e72b08a70e3bc6f76
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
@@ -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.3'.freeze
4
+ VERSION = '1.0.0'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: classnames-rails-view
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masamoto Miyata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-11 00:00:00.000000000 Z
11
+ date: 2018-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails