rails-timeago 2.16.0 → 2.17.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +53 -0
  3. data/.travis.yml +20 -8
  4. data/CHANGELOG.md +8 -0
  5. data/Gemfile +3 -5
  6. data/Rakefile +14 -12
  7. data/lib/assets/javascripts/rails-timeago-all.js +4 -0
  8. data/lib/rails-timeago.rb +21 -17
  9. data/lib/rails-timeago/helper.rb +13 -10
  10. data/lib/rails-timeago/version.rb +4 -2
  11. data/rails-timeago.gemspec +13 -11
  12. data/spec/rails-timeago_spec.rb +2 -0
  13. data/spec/spec_helper.rb +2 -0
  14. data/spec/support/stub.rb +11 -9
  15. data/spec/timeago/helper_spec.rb +27 -25
  16. data/vendor/assets/javascripts/jquery.timeago.js +1 -1
  17. data/vendor/assets/javascripts/locales/jquery.timeago.af.js +30 -20
  18. data/vendor/assets/javascripts/locales/jquery.timeago.am.js +30 -0
  19. data/vendor/assets/javascripts/locales/jquery.timeago.ar.js +12 -4
  20. data/vendor/assets/javascripts/locales/jquery.timeago.az-short.js +30 -20
  21. data/vendor/assets/javascripts/locales/jquery.timeago.az.js +30 -20
  22. data/vendor/assets/javascripts/locales/jquery.timeago.be.js +43 -0
  23. data/vendor/assets/javascripts/locales/jquery.timeago.bg.js +28 -18
  24. data/vendor/assets/javascripts/locales/jquery.timeago.bs.js +13 -7
  25. data/vendor/assets/javascripts/locales/jquery.timeago.ca.js +30 -20
  26. data/vendor/assets/javascripts/locales/jquery.timeago.cs.js +34 -24
  27. data/vendor/assets/javascripts/locales/jquery.timeago.cy.js +30 -20
  28. data/vendor/assets/javascripts/locales/jquery.timeago.da.js +28 -18
  29. data/vendor/assets/javascripts/locales/jquery.timeago.de-short.js +30 -20
  30. data/vendor/assets/javascripts/locales/jquery.timeago.de.js +28 -18
  31. data/vendor/assets/javascripts/locales/jquery.timeago.dv.js +32 -22
  32. data/vendor/assets/javascripts/locales/jquery.timeago.el.js +28 -18
  33. data/vendor/assets/javascripts/locales/jquery.timeago.en-short.js +30 -20
  34. data/vendor/assets/javascripts/locales/jquery.timeago.es-short.js +31 -20
  35. data/vendor/assets/javascripts/locales/jquery.timeago.es.js +29 -18
  36. data/vendor/assets/javascripts/locales/jquery.timeago.et.js +28 -18
  37. data/vendor/assets/javascripts/locales/jquery.timeago.eu.js +28 -17
  38. data/vendor/assets/javascripts/locales/jquery.timeago.fa-short.js +30 -20
  39. data/vendor/assets/javascripts/locales/jquery.timeago.fa.js +32 -22
  40. data/vendor/assets/javascripts/locales/jquery.timeago.fi.js +38 -28
  41. data/vendor/assets/javascripts/locales/jquery.timeago.fr-short.js +26 -16
  42. data/vendor/assets/javascripts/locales/jquery.timeago.fr.js +27 -17
  43. data/vendor/assets/javascripts/locales/jquery.timeago.gl.js +28 -18
  44. data/vendor/assets/javascripts/locales/jquery.timeago.he.js +26 -16
  45. data/vendor/assets/javascripts/locales/jquery.timeago.hr.js +53 -48
  46. data/vendor/assets/javascripts/locales/jquery.timeago.hu.js +28 -18
  47. data/vendor/assets/javascripts/locales/jquery.timeago.hy.js +28 -18
  48. data/vendor/assets/javascripts/locales/jquery.timeago.id.js +29 -18
  49. data/vendor/assets/javascripts/locales/jquery.timeago.is.js +29 -19
  50. data/vendor/assets/javascripts/locales/jquery.timeago.it-short.js +30 -20
  51. data/vendor/assets/javascripts/locales/jquery.timeago.it.js +28 -16
  52. data/vendor/assets/javascripts/locales/jquery.timeago.ja.js +29 -19
  53. data/vendor/assets/javascripts/locales/jquery.timeago.jv.js +28 -18
  54. data/vendor/assets/javascripts/locales/jquery.timeago.ko.js +31 -20
  55. data/vendor/assets/javascripts/locales/jquery.timeago.ky.js +11 -3
  56. data/vendor/assets/javascripts/locales/jquery.timeago.lt.js +30 -20
  57. data/vendor/assets/javascripts/locales/jquery.timeago.lv.js +30 -20
  58. data/vendor/assets/javascripts/locales/jquery.timeago.mk.js +30 -20
  59. data/vendor/assets/javascripts/locales/jquery.timeago.nl.js +30 -20
  60. data/vendor/assets/javascripts/locales/jquery.timeago.no.js +28 -18
  61. data/vendor/assets/javascripts/locales/jquery.timeago.pl.js +11 -3
  62. data/vendor/assets/javascripts/locales/jquery.timeago.pt-br-short.js +30 -20
  63. data/vendor/assets/javascripts/locales/jquery.timeago.pt-br.js +28 -18
  64. data/vendor/assets/javascripts/locales/jquery.timeago.pt-short.js +30 -20
  65. data/vendor/assets/javascripts/locales/jquery.timeago.pt.js +26 -16
  66. data/vendor/assets/javascripts/locales/jquery.timeago.ro.js +29 -18
  67. data/vendor/assets/javascripts/locales/jquery.timeago.rs.js +53 -48
  68. data/vendor/assets/javascripts/locales/jquery.timeago.ru.js +11 -3
  69. data/vendor/assets/javascripts/locales/jquery.timeago.rw.js +30 -20
  70. data/vendor/assets/javascripts/locales/jquery.timeago.si.js +28 -18
  71. data/vendor/assets/javascripts/locales/jquery.timeago.sk.js +34 -24
  72. data/vendor/assets/javascripts/locales/jquery.timeago.sl.js +45 -39
  73. data/vendor/assets/javascripts/locales/jquery.timeago.sq.js +26 -0
  74. data/vendor/assets/javascripts/locales/jquery.timeago.sr.js +53 -48
  75. data/vendor/assets/javascripts/locales/jquery.timeago.sv.js +28 -18
  76. data/vendor/assets/javascripts/locales/jquery.timeago.th.js +30 -20
  77. data/vendor/assets/javascripts/locales/jquery.timeago.tr-short.js +30 -20
  78. data/vendor/assets/javascripts/locales/jquery.timeago.tr.js +26 -16
  79. data/vendor/assets/javascripts/locales/jquery.timeago.uk.js +11 -3
  80. data/vendor/assets/javascripts/locales/jquery.timeago.ur.js +30 -0
  81. data/vendor/assets/javascripts/locales/jquery.timeago.uz.js +29 -19
  82. data/vendor/assets/javascripts/locales/jquery.timeago.vi.js +30 -20
  83. data/vendor/assets/javascripts/locales/jquery.timeago.zh-CN.js +31 -20
  84. data/vendor/assets/javascripts/locales/jquery.timeago.zh-TW.js +30 -20
  85. metadata +8 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e222f14c7d1cb6e5c1866fa9155239acf3de0cd5
4
- data.tar.gz: 1fb324458d3a7f7d080bee1a675432abf74c31f9
2
+ SHA256:
3
+ metadata.gz: 2a461a19bf99a6641dd323cc311fbe23639a4eded603978e60eeac161bd3c881
4
+ data.tar.gz: 36cd1871b9bba6edd02c1d2d61d4feba89e0975e5929ea69cb7997f0faa848e6
5
5
  SHA512:
6
- metadata.gz: 9feab0dd1ff9b30c4e43a9f8b5019375bbec20631f89a5a0e632b9880232328c2ced4b7e42863fc7978248ad02dd84702442a4e48e2d503e59926dd7f0444541
7
- data.tar.gz: 65e9377f69879575f6b35a93daf1ba2578e50bbd1b2043f13df52f20186bbde6952bef21e4c7be018f4541d6992860520a249941491ea86905132af7f46017f5
6
+ metadata.gz: 387c7200e0aaf52c67f96e7f04b73188912e284dc6778802971dd25b84f6da64328c50eb62377036b1c34bf0c566a69a5384cdd954306704ee1f1f351ebabceb
7
+ data.tar.gz: f29914c87ee1d593a383d16e1c3bb113df347708e1b3263efe3d3d71de2d1211fb4440687cabcb5de562e40c6dfbb7862401b104df4ffb72aaaaa0e6767382b9
data/.rubocop.yml ADDED
@@ -0,0 +1,53 @@
1
+ AllCops:
2
+ Include:
3
+ - '**/*.rb'
4
+ TargetRubyVersion: 2.1
5
+
6
+ Metrics/BlockLength:
7
+ Exclude:
8
+ - 'spec/**/*_spec.rb'
9
+
10
+ Metrics/LineLength:
11
+ Exclude:
12
+ - 'spec/**/*_spec.rb'
13
+
14
+ Style/AlignParameters:
15
+ EnforcedStyle: with_fixed_indentation
16
+
17
+ Style/BracesAroundHashParameters:
18
+ EnforcedStyle: context_dependent
19
+
20
+ Style/SpaceInsideHashLiteralBraces:
21
+ EnforcedStyle: no_space
22
+
23
+ Style/RaiseArgs:
24
+ EnforcedStyle: compact
25
+
26
+ Style/Documentation:
27
+ Enabled: false
28
+
29
+ Style/SpaceInsideBlockBraces:
30
+ EnforcedStyle: space
31
+ EnforcedStyleForEmptyBraces: no_space
32
+ SpaceBeforeBlockParameters: false
33
+
34
+ Style/SignalException:
35
+ EnforcedStyle: only_raise
36
+
37
+ Style/CaseIndentation:
38
+ EnforcedStyle: end
39
+ SupportedStyles:
40
+ - case
41
+ - end
42
+ IndentOneStep: true
43
+
44
+ Style/ClassAndModuleChildren:
45
+ Enabled: false
46
+
47
+ Style/TrivialAccessors:
48
+ AllowPredicates: true
49
+
50
+ Style/FileName:
51
+ Exclude:
52
+ - Rakefile
53
+ - Gemfile
data/.travis.yml CHANGED
@@ -1,12 +1,24 @@
1
- sudo: false
2
1
  dist: trusty
3
2
  language: ruby
4
3
  rvm:
5
- - '2.4.1'
6
- - '2.3.4'
7
- - '2.2.7'
8
- - '2.1.10'
9
- - 'jruby-9.1.8.0'
4
+ - 2.6.0
5
+ - 2.5.3
6
+ - 2.4.5
7
+ - 2.3.8
10
8
  before_install:
11
- - gem update --system
12
- - gem install bundler
9
+ - gem install bundler
10
+ jobs:
11
+ include:
12
+ - stage: Release
13
+ rvm: 2.6.0
14
+ env: []
15
+ script: skip
16
+ install: skip
17
+ deploy:
18
+ provider: rubygems
19
+ api_key:
20
+ secure: XYbT9MB6DNzKu95OqrA5qIV2rD1L6RLpfCb9s/3YnhKY8tTP1NcitvmXLHtNLAoHldYrb9AmSfNh5wFgFnfoqFkpz4B94SBrkQtGZ9wzIj4otxMgntGsrGd6qLBfnXGG8rctngeJlo0eVKkE/3fJtiXb5mEx72fvxd2+/fYfubY=
21
+ gem: rails-timeago
22
+ on:
23
+ tags: true
24
+ repo: jgraichen/rails-timeago
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.17.1
4
+
5
+ * Maintenance release without code changes
6
+
7
+ ## 2.17.0
8
+
9
+ * Update jquery-timeago and locales from upstream
10
+
3
11
  ## 2.16.0
4
12
 
5
13
  * Update jquery-timeago and locales from upstream
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in rails-timeago.gemspec
@@ -8,11 +10,7 @@ group :development do
8
10
  end
9
11
 
10
12
  group :test do
11
- gem 'rspec', '~> 3.5'
12
13
  gem 'capybara', '~> 2.8'
13
14
  gem 'poltergeist', '~> 1.10'
15
+ gem 'rspec', '~> 3.5'
14
16
  end
15
-
16
- gem 'rack', '~> 1.0' # Otherwise requires Ruby > 2.2.
17
-
18
- gem 'rubysl', platform: :rbx
data/Rakefile CHANGED
@@ -1,45 +1,47 @@
1
1
  #!/usr/bin/env rake
2
- require "bundler/gem_tasks"
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/gem_tasks'
3
5
  require 'rspec/core/rake_task'
4
6
 
5
7
  RSpec::Core::RakeTask.new(:spec)
6
8
 
7
- task :default => :spec
9
+ task default: :spec
8
10
 
9
11
  desc 'Update jquery-timeago from upstream'
10
12
  task :update do
11
- puts "Clone repository.."
13
+ puts 'Clone repository..'
12
14
  puts `mkdir ./tmp`
13
15
  puts `git clone https://github.com/rmm5t/jquery-timeago.git ./tmp`
14
16
 
15
- puts "Patch jquery timeago..."
17
+ puts 'Patch jquery timeago...'
16
18
  puts `cd ./tmp && patch -p1 < ../scripts/jquery.timeago.js.patch`
17
19
 
18
20
  print 'Patch locale files ... '
19
21
  `rm ./tmp/locales/jquery.timeago.en.js`
20
22
 
21
- is_mac = RUBY_PLATFORM.downcase.include?("darwin")
23
+ is_mac = RUBY_PLATFORM.downcase.include?('darwin')
22
24
 
23
- Dir["./tmp/locales/*.js"].each do |file|
25
+ Dir['./tmp/locales/*.js'].each do |file|
24
26
  if file =~ /jquery\.timeago\.(.+)\.js$/
25
- `sed -i#{(is_mac)? " ''": nil} "s/timeago.settings.strings/timeago.settings.strings[\\"#{$1}\\"]/" #{file}`
26
- print "#{$1} "
27
+ `sed -i#{is_mac ? " ''" : nil} "s/timeago.settings.strings/timeago.settings.strings[\\"#{Regexp.last_match(1)}\\"]/" #{file}`
28
+ print "#{Regexp.last_match(1)} "
27
29
  end
28
30
  end
29
31
  puts
30
32
 
31
- puts "Copying asset files..."
33
+ puts 'Copying asset files...'
32
34
  puts `cp ./tmp/jquery.timeago.js ./vendor/assets/javascripts/`
33
35
  puts `rm ./vendor/assets/javascripts/locales/*`
34
36
  puts `cp ./tmp/locales/*.js ./vendor/assets/javascripts/locales`
35
37
 
36
- puts "Generate rails-timeago-all.js..."
38
+ puts 'Generate rails-timeago-all.js...'
37
39
  `echo "// Rails timeago bootstrap with all locales" > ./lib/assets/javascripts/rails-timeago-all.js`
38
40
  `echo "//= require rails-timeago" >> ./lib/assets/javascripts/rails-timeago-all.js`
39
- Dir["./vendor/assets/javascripts/locales/*.js"].sort.each do |file|
41
+ Dir['./vendor/assets/javascripts/locales/*.js'].sort.each do |file|
40
42
  `echo "//= require locales/#{File.basename(file)}" >> ./lib/assets/javascripts/rails-timeago-all.js`
41
43
  end
42
44
 
43
- puts "Clean up..."
45
+ puts 'Clean up...'
44
46
  puts `rm -rf ./tmp`
45
47
  end
@@ -1,9 +1,11 @@
1
1
  // Rails timeago bootstrap with all locales
2
2
  //= require rails-timeago
3
3
  //= require locales/jquery.timeago.af.js
4
+ //= require locales/jquery.timeago.am.js
4
5
  //= require locales/jquery.timeago.ar.js
5
6
  //= require locales/jquery.timeago.az-short.js
6
7
  //= require locales/jquery.timeago.az.js
8
+ //= require locales/jquery.timeago.be.js
7
9
  //= require locales/jquery.timeago.bg.js
8
10
  //= require locales/jquery.timeago.bs.js
9
11
  //= require locales/jquery.timeago.ca.js
@@ -54,12 +56,14 @@
54
56
  //= require locales/jquery.timeago.si.js
55
57
  //= require locales/jquery.timeago.sk.js
56
58
  //= require locales/jquery.timeago.sl.js
59
+ //= require locales/jquery.timeago.sq.js
57
60
  //= require locales/jquery.timeago.sr.js
58
61
  //= require locales/jquery.timeago.sv.js
59
62
  //= require locales/jquery.timeago.th.js
60
63
  //= require locales/jquery.timeago.tr-short.js
61
64
  //= require locales/jquery.timeago.tr.js
62
65
  //= require locales/jquery.timeago.uk.js
66
+ //= require locales/jquery.timeago.ur.js
63
67
  //= require locales/jquery.timeago.uz.js
64
68
  //= require locales/jquery.timeago.vi.js
65
69
  //= require locales/jquery.timeago.zh-CN.js
data/lib/rails-timeago.rb CHANGED
@@ -1,11 +1,13 @@
1
- require "rails-timeago/version"
2
- require "rails-timeago/helper"
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails-timeago/version'
4
+ require 'rails-timeago/helper'
3
5
 
4
6
  module Rails
5
7
  module Timeago
6
8
  if defined?(::Rails::Engine)
7
9
  class Engine < ::Rails::Engine # :nodoc:
8
- initializer 'rails-timeago', :group => :all do |app|
10
+ initializer 'rails-timeago', group: :all do |_app|
9
11
  ActiveSupport.on_load(:action_controller) do
10
12
  include Rails::Timeago::Helper
11
13
  end
@@ -17,8 +19,8 @@ module Rails
17
19
  end
18
20
  end
19
21
 
20
- # Read or write global rails-timeago default options. If no options are given
21
- # the current defaults will be returned.
22
+ # Read or write global rails-timeago default options. If no options are
23
+ # given the current defaults will be returned.
22
24
  #
23
25
  # Available options:
24
26
  # [:+nojs+]
@@ -34,8 +36,9 @@ module Rails
34
36
  # (default: :default)
35
37
  #
36
38
  # [:+limit+]
37
- # Set a limit for time ago tags. All dates before given limit will not be converted.
38
- # Global limit should be given as a block to reevaluate limit each time timeago_tag is called.
39
+ # Set a limit for time ago tags. All dates before given limit will not
40
+ # be converted. Global limit should be given as a block to reevaluate
41
+ # limit each time timeago_tag is called.
39
42
  # (default: proc { 4.days.ago })
40
43
  #
41
44
  # [:+force+]
@@ -47,9 +50,10 @@ module Rails
47
50
  # (default: '-')
48
51
  #
49
52
  def self.default_options(opts = nil)
50
- @defaults ||= self.option_hash
53
+ @defaults ||= option_hash
51
54
  if opts
52
- @defaults.merge! opts.extract!(*@defaults.keys.select{|k| opts.include?(k)})
55
+ @defaults.merge! \
56
+ opts.extract!(*@defaults.keys.select {|k| opts.include?(k) })
53
57
  else
54
58
  @defaults
55
59
  end
@@ -57,18 +61,18 @@ module Rails
57
61
 
58
62
  # Reset options to default values
59
63
  def self.reset_default_options
60
- @defaults = self.option_hash
64
+ @defaults = option_hash
61
65
  end
62
66
 
63
67
  def self.option_hash
64
68
  {
65
- :nojs => false,
66
- :force => false,
67
- :format => :default,
68
- :limit => proc { 4.days.ago },
69
- :date_only => true,
70
- :default => '-',
71
- :title => proc { |time, options| I18n.l time, :format => options[:format] }
69
+ nojs: false,
70
+ force: false,
71
+ format: :default,
72
+ limit: proc { 4.days.ago },
73
+ date_only: true,
74
+ default: '-',
75
+ title: proc {|time, options| I18n.l time, format: options[:format] }
72
76
  }
73
77
  end
74
78
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/time'
2
4
 
3
5
  module Rails
@@ -6,7 +8,9 @@ module Rails
6
8
  # Create a time tag usable for jQuery timeago plugin.
7
9
  #
8
10
  # timeago_tag Time.zone.now
9
- # => "<time datetime="2012-03-10T12:07:07+01:00" title="Sat, 10 Mar 2012 12:07:07 +0100" data-time-ago="2012-03-10T12:07:07+01:00">2012-03-10</time>"
11
+ # => "<time datetime="2012-03-10T12:07:07+01:00"
12
+ # title="Sat, 10 Mar 2012 12:07:07 +0100"
13
+ # data-time-ago="2012-03-10T12:07:07+01:00">2012-03-10</time>"
10
14
  #
11
15
  # Available options:
12
16
  # [:+nojs+]
@@ -22,7 +26,8 @@ module Rails
22
26
  # (default: :default)
23
27
  #
24
28
  # [:+limit+]
25
- # Set a limit for time ago tags. All dates before given limit will not be converted.
29
+ # Set a limit for time ago tags. All dates before given limit
30
+ # will not be converted.
26
31
  # (default: 4.days.ago)
27
32
  #
28
33
  # [:+force+]
@@ -38,12 +43,12 @@ module Rails
38
43
  def timeago_tag(time, html_options = {})
39
44
  time_options = Rails::Timeago.default_options
40
45
 
41
- time_options = time_options.merge html_options.extract!(*time_options.keys.select{|k| html_options.include?(k)})
46
+ time_options = time_options.merge html_options.extract!(*time_options.keys.select {|k| html_options.include?(k) })
42
47
  return time_options[:default] if time.nil?
43
48
 
44
49
  time_options[:format] = time_options[:format].call(time, time_options) if time_options[:format].is_a?(Proc)
45
50
  if time_options[:title]
46
- html_options.merge! :title => time_options[:title].is_a?(Proc) ? time_options[:title].call(time, time_options) : time_options[:title]
51
+ html_options[:title] = time_options[:title].is_a?(Proc) ? time_options[:title].call(time, time_options) : time_options[:title]
47
52
  end
48
53
  time_options[:limit] = time_options[:limit].call if time_options[:limit].is_a?(Proc)
49
54
 
@@ -51,21 +56,19 @@ module Rails
51
56
  now = Time.zone.now
52
57
  limit = time_options[:limit]
53
58
  limit < now ? limit...now : now...limit
54
- else
55
- nil
56
59
  end
57
60
 
58
- if time_options[:force] or time_range.nil? or time_range.cover?(time)
59
- html_options.merge!('data-time-ago' => time.iso8601)
61
+ if time_options[:force] || time_range.nil? || time_range.cover?(time)
62
+ html_options['data-time-ago'] = time.iso8601
60
63
  end
61
64
  time_tag time, timeago_tag_content(time, time_options), html_options
62
65
  end
63
66
 
64
67
  def timeago_tag_content(time, time_options = {}) # :nodoc:
65
68
  time = time.to_date if time_options[:date_only]
66
- return time_ago_in_words(time) if time_options[:nojs] and (time_options[:limit].nil? or time_options[:limit] < time)
69
+ return time_ago_in_words(time) if time_options[:nojs] && (time_options[:limit].nil? || time_options[:limit] < time)
67
70
 
68
- I18n.l time, :format => time_options[:format]
71
+ I18n.l time, format: time_options[:format]
69
72
  end
70
73
 
71
74
  # Return a JavaScript tag to set jQuery timeago locale.
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Rails
2
4
  module Timeago
3
5
  module VERSION
4
6
  MAJOR = 2
5
- MINOR = 16
6
- PATCH = 0
7
+ MINOR = 17
8
+ PATCH = 1
7
9
  STAGE = nil
8
10
  STRING = [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join('.').freeze
9
11
 
@@ -1,21 +1,23 @@
1
1
  # -*- encoding: utf-8 -*-
2
+ # frozen_string_literal: true
3
+
2
4
  require File.expand_path('../lib/rails-timeago/version', __FILE__)
3
5
 
4
6
  Gem::Specification.new do |gem|
5
- gem.authors = ["Jan Graichen"]
6
- gem.email = ["jan.graichen@altimos.de"]
7
- gem.description = %q{jQuery Timeago helper for Rails 3}
8
- gem.summary = %q{A Rails Helper to create time tags usable for jQuery Timeago plugin}
9
- gem.homepage = "https://github.com/jgraichen/rails-timeago"
7
+ gem.authors = ['Jan Graichen']
8
+ gem.email = ['jan.graichen@altimos.de']
9
+ gem.description = 'jQuery Timeago helper for Rails 3'
10
+ gem.summary = 'A Rails Helper to create time tags usable for jQuery Timeago plugin'
11
+ gem.homepage = 'https://github.com/jgraichen/rails-timeago'
10
12
  gem.license = 'MIT'
11
13
 
12
- gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
13
- gem.files = `git ls-files`.split("\n").reject{|file| file =~ /^scripts/}
14
+ gem.executables = `git ls-files -- bin/*`.split("\n").map {|f| File.basename(f) }
15
+ gem.files = `git ls-files`.split("\n").reject {|file| file =~ /^scripts/ }
14
16
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
- gem.name = "rails-timeago"
16
- gem.require_paths = ["lib"]
17
+ gem.name = 'rails-timeago'
18
+ gem.require_paths = ['lib']
17
19
  gem.version = Rails::Timeago::VERSION
18
20
 
19
- gem.add_dependency "activesupport", ">= 3.1"
20
- gem.add_dependency "actionpack", ">= 3.1"
21
+ gem.add_dependency 'activesupport', '>= 3.1'
22
+ gem.add_dependency 'actionpack', '>= 3.1'
21
23
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe 'rails-timeago', type: :feature, js: true do
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support'
2
4
  require 'active_support/core_ext'
3
5
 
data/spec/support/stub.rb CHANGED
@@ -1,15 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class TimeagoStub
2
4
  include Rails::Timeago::Helper
3
5
 
4
- I18n.backend.store_translations :en, :hello => 'World'
6
+ I18n.backend.store_translations :en, hello: 'World'
5
7
 
6
8
  def time_tag(time, content, options = {})
7
- options = options.map { |k,v| "#{k}=\"#{v}\""}
9
+ options = options.map {|k, v| "#{k}=\"#{v}\"" }
8
10
  "<time datetime=\"#{time.iso8601}\" #{options.join ' '}>#{content}</time>"
9
11
  end
10
12
 
11
- def time_ago_in_words(time)
12
- "%time_ago_in_words%"
13
+ def time_ago_in_words(_time)
14
+ '%time_ago_in_words%'
13
15
  end
14
16
 
15
17
  def javascript_tag(source)
@@ -21,7 +23,7 @@ class Application
21
23
  attr_accessor :render
22
24
 
23
25
  ASSET_BASE = Pathname.new(File.expand_path('../../..', __FILE__))
24
- ASSET_DIRECTORIES = %w(lib/assets vendor/assets spec/support/assets)
26
+ ASSET_DIRECTORIES = %w[lib/assets vendor/assets spec/support/assets].freeze
25
27
 
26
28
  def initialize
27
29
  @helper = TimeagoStub.new
@@ -39,10 +41,10 @@ class Application
39
41
 
40
42
  def call_render
41
43
  body = if @render
42
- @render.call(@helper, @request)
43
- else
44
- '<noscript></noscript>'
45
- end
44
+ @render.call(@helper, @request)
45
+ else
46
+ '<noscript></noscript>'
47
+ end
46
48
 
47
49
  <<-HTML
48
50
  <html>