├── .coveralls.yml ├── .document ├── .gitignore ├── .rvmrc ├── .travis.yml ├── Gemfile ├── Gemfile.lock ├── LICENSE.txt ├── README ├── README.rdoc ├── Rakefile ├── VERSION ├── lib ├── en.yml └── time_diff.rb ├── test ├── helper.rb └── test_time_diff.rb └── time_diff.gemspec /.coveralls.yml: -------------------------------------------------------------------------------- 1 | repo_token: SvopcwDKb68O88s8X9fkrPbombd3fd00K 2 | -------------------------------------------------------------------------------- /.document: -------------------------------------------------------------------------------- 1 | lib/**/*.rb 2 | bin/* 3 | - 4 | features/**/*.feature 5 | LICENSE.txt 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # rcov generated 2 | coverage 3 | 4 | # rdoc generated 5 | rdoc 6 | 7 | # yard generated 8 | doc 9 | .yardoc 10 | 11 | # bundler 12 | .bundle 13 | 14 | # jeweler generated 15 | pkg 16 | 17 | # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore: 18 | # 19 | # * Create a file at ~/.gitignore 20 | # * Include files you want ignored 21 | # * Run: git config --global core.excludesfile ~/.gitignore 22 | # 23 | # After doing this, these files will be ignored in all your git projects, 24 | # saving you from having to 'pollute' every project you touch with them 25 | # 26 | # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line) 27 | # 28 | # For MacOS: 29 | # 30 | #.DS_Store 31 | # 32 | # For TextMate 33 | #*.tmproj 34 | #tmtags 35 | # 36 | # For emacs: 37 | #*~ 38 | #\#* 39 | #.\#* 40 | # 41 | # For vim: 42 | #*.swp 43 | -------------------------------------------------------------------------------- /.rvmrc: -------------------------------------------------------------------------------- 1 | rvm use time_diff@ruby-1.8.7-p352 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | rvm: 3 | - "1.8.7" 4 | script: ruby -I test test/test_time_diff.rb 5 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" 2 | 3 | gem 'activesupport' 4 | gem 'i18n' 5 | gem 'coveralls', :require => false 6 | # Add dependencies required to use your gem here. 7 | # Example: 8 | # gem "activesupport", ">= 2.3.5" 9 | 10 | # Add dependencies to develop your gem here. 11 | # Include everything needed to run rake, tests, features, etc. 12 | group :development do 13 | gem "shoulda", ">= 0" 14 | gem "bundler" 15 | gem "rcov", ">= 0" 16 | end 17 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: http://rubygems.org/ 3 | specs: 4 | activesupport (3.0.1) 5 | colorize (0.5.8) 6 | coveralls (0.6.7) 7 | colorize 8 | multi_json (~> 1.3) 9 | rest-client 10 | simplecov (>= 0.7) 11 | thor 12 | i18n (0.4.2) 13 | mime-types (1.23) 14 | multi_json (1.7.2) 15 | rcov (0.9.9) 16 | rest-client (1.6.7) 17 | mime-types (>= 1.16) 18 | shoulda (2.11.3) 19 | simplecov (0.7.1) 20 | multi_json (~> 1.0) 21 | simplecov-html (~> 0.7.1) 22 | simplecov-html (0.7.1) 23 | thor (0.18.1) 24 | 25 | PLATFORMS 26 | ruby 27 | 28 | DEPENDENCIES 29 | activesupport 30 | bundler 31 | coveralls 32 | i18n 33 | rcov 34 | shoulda 35 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 abhilash 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | = time_diff 2 | Gem which calculates the difference between two time 3 | 4 | == Installation 5 | 6 | gem install time_diff 7 | 8 | == Usage 9 | 10 | require 'time_diff' 11 | 12 | time_diff_components = Time.diff(start_date_time, end_date_time) 13 | 14 | This will return the hash of time difference in terms of years, month, week, day, hour, minute and second. 15 | 16 | You can use the difference like: 17 | 18 | time_diff_components[:year], time_diff_components[:month], time_diff_components[:week] 19 | 20 | == Formatted Time difference 21 | 22 | %y - year 23 | 24 | %M - month 25 | 26 | %w - week 27 | 28 | %d - day 29 | 30 | %H - hour 31 | 32 | %N - minute 33 | 34 | %S - second 35 | 36 | %h - hour (without adding 'hour' text to the hours. eg: 3 for 3 hours) 37 | 38 | %m - minute (without adding 'minute' text) 39 | 40 | %s - second (without adding 'second' text) 41 | 42 | By default the format is 43 | 44 | '%y, %M, %w, %d and %h:%m:%s' 45 | 46 | this will return 47 | 48 | '1 year, 2 months, 3 weeks, 4 days and 12:05:52'. 49 | 50 | You will get the result from the output hash, time_diff_components[:diff] 51 | 52 | You can pass your own format as third parameter to this function. 53 | 54 | If you give '%d %h' as the third parameter to the Time.diff() method, then the difference(time_diff_components[:diff]) will be calculated only in days and hours. 55 | 56 | == Examples 57 | 58 | > Time.diff(Time.parse('2011-03-06'), Time.parse('2011-03-07')) 59 | => {:year => 0, :month => 0, :week => 0, :day => 1, :hour => 0, :minute => 0, :second => 0, :diff => '1 day and 00:00:00'} 60 | > Time.diff(Time.parse('2010-03-06 12:30:00'), Time.parse('2011-03-07 12:30:30'), '%y, %d and %h:%m:%s') 61 | => {:year => 1, :month => 0, :week => 0, :day => 0, :hour => 18, :minute => 0, :second => 30, :diff => '1 year and 18:00:30'} 62 | > Time.diff(Time.parse('2011-03-06 12:30:00'), Time.parse('2011-03-07 12:30:30'), '%H %N %S') 63 | => {:year => 0, :month => 0, :week => 0, :day => 1, :hour => 0, :minute => 0, :second => 30, :diff => '24 hours 0 minute 30 seconds'} 64 | 65 | == i18n support 66 | 67 | Add locales for day, days, week, weeks, year, hour, hours, minute, minutes, second, and seconds in your YAML file. For eg: 68 | en: 69 | day: divasam 70 | days: divasangal 71 | -------------------------------------------------------------------------------- /README.rdoc: -------------------------------------------------------------------------------- 1 | = time_diff 2 | Gem which calculates the difference between two time 3 | 4 | {Gem Version}[http://badge.fury.io/rb/time_diff] 5 | {}[https://travis-ci.org/abhidsm/time_diff] 6 | {}[https://codeclimate.com/github/abhidsm/time_diff] 7 | {}[https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=abhidsm%40gmail%2ecom&lc=US&item_name=time_diff&no_note=0¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest] 8 | 9 | 10 | == Installation 11 | 12 | gem install time_diff 13 | 14 | == Usage 15 | 16 | require 'time_diff' 17 | 18 | time_diff_components = Time.diff(start_date_time, end_date_time) 19 | 20 | This will return the hash of time difference in terms of years, month, week, day, hour, minute and second. 21 | 22 | You can use the difference like: 23 | 24 | time_diff_components[:year], time_diff_components[:month], time_diff_components[:week] 25 | 26 | == Formatted Time difference 27 | 28 | %y - year 29 | 30 | %M - month 31 | 32 | %w - week 33 | 34 | %d - day 35 | 36 | %H - hour 37 | 38 | %N - minute 39 | 40 | %S - second 41 | 42 | %h - hour (without adding 'hour' text to the hours. eg: 3 for 3 hours) 43 | 44 | %m - minute (without adding 'minute' text) 45 | 46 | %s - second (without adding 'second' text) 47 | 48 | By default the format is 49 | 50 | '%y, %M, %w, %d and %h:%m:%s' 51 | 52 | this will return 53 | 54 | '1 year, 2 months, 3 weeks, 4 days and 12:05:52'. 55 | 56 | You will get the result from the output hash, time_diff_components[:diff] 57 | 58 | You can pass your own format as third parameter to this function. 59 | 60 | If you give '%d %h' as the third parameter to the Time.diff() method, then the difference(time_diff_components[:diff]) will be calculated only in days and hours. 61 | 62 | == Examples 63 | 64 | > Time.diff(Time.parse('2011-03-06'), Time.parse('2011-03-07')) 65 | => {:year => 0, :month => 0, :week => 0, :day => 1, :hour => 0, :minute => 0, :second => 0, :diff => '1 day and 00:00:00'} 66 | > Time.diff(Time.parse('2010-03-06 12:30:00'), Time.parse('2011-03-07 12:30:30'), '%y, %d and %h:%m:%s') 67 | => {:year => 1, :month => 0, :week => 0, :day => 0, :hour => 18, :minute => 0, :second => 30, :diff => '1 year and 18:00:30'} 68 | > Time.diff(Time.parse('2011-03-06 12:30:00'), Time.parse('2011-03-07 12:30:30'), '%H %N %S') 69 | => {:year => 0, :month => 0, :week => 0, :day => 1, :hour => 0, :minute => 0, :second => 30, :diff => '24 hours 0 minute 30 seconds'} 70 | 71 | == i18n support 72 | 73 | Add translations for day, days, week, weeks, year, hour, hours, minute, minutes, second, and seconds in your YAML file. For eg: 74 | 75 | en: 76 | day: divasam 77 | days: divasangal 78 | 79 | == Contributing to time_diff 80 | 81 | * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet 82 | * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it 83 | * Fork the project 84 | * Start a feature/bugfix branch 85 | * Commit and push until you are happy with your contribution 86 | * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally. 87 | * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it. 88 | 89 | == Copyright 90 | 91 | Copyright (c) 2011 abhidsm. See LICENSE.txt for 92 | further details. 93 | 94 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'bundler' 3 | begin 4 | Bundler.setup(:default, :development) 5 | rescue Bundler::BundlerError => e 6 | $stderr.puts e.message 7 | $stderr.puts "Run `bundle install` to install missing gems" 8 | exit e.status_code 9 | end 10 | require 'rake' 11 | 12 | require 'jeweler' 13 | Jeweler::Tasks.new do |gem| 14 | # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options 15 | gem.name = "time_diff" 16 | gem.homepage = "http://github.com/abhidsm/time_diff" 17 | gem.license = "MIT" 18 | gem.summary = %Q{Gem to get the difference between two time} 19 | gem.description = %Q{It returns a hash file with the difference in terms of year, month, week, day, hour, minute and second} 20 | gem.email = "abhidsm@gmail.com" 21 | gem.authors = ["abhilash"] 22 | # Include your dependencies below. Runtime dependencies are required when using your gem, 23 | # and development dependencies are only needed for development (ie running rake tasks, tests, etc) 24 | # gem.add_runtime_dependency 'jabber4r', '> 0.1' 25 | # gem.add_development_dependency 'rspec', '> 1.2.3' 26 | end 27 | Jeweler::RubygemsDotOrgTasks.new 28 | 29 | require 'rake/testtask' 30 | Rake::TestTask.new(:test) do |test| 31 | test.libs << 'lib' << 'test' 32 | test.pattern = 'test/**/test_*.rb' 33 | test.verbose = true 34 | end 35 | 36 | require 'rcov/rcovtask' 37 | Rcov::RcovTask.new do |test| 38 | test.libs << 'test' 39 | test.pattern = 'test/**/test_*.rb' 40 | test.verbose = true 41 | end 42 | 43 | task :default => :test 44 | 45 | require 'rake/rdoctask' 46 | Rake::RDocTask.new do |rdoc| 47 | version = File.exist?('VERSION') ? File.read('VERSION') : "" 48 | 49 | rdoc.rdoc_dir = 'rdoc' 50 | rdoc.title = "time_diff #{version}" 51 | rdoc.rdoc_files.include('README*') 52 | rdoc.rdoc_files.include('lib/**/*.rb') 53 | end 54 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.3.0 -------------------------------------------------------------------------------- /lib/en.yml: -------------------------------------------------------------------------------- 1 | en: 2 | day: "divasam" 3 | days: "divasangal" 4 | week: "azhcha" 5 | weeks: "azhchzkal" 6 | 7 | -------------------------------------------------------------------------------- /lib/time_diff.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'active_support/all' 3 | require 'i18n' 4 | 5 | class Time 6 | def self.diff(start_date, end_date, format_string='%y, %M, %w, %d and %h:%m:%s') 7 | #I18n.load_path += Dir.glob("lib/*.yml") 8 | start_time = start_date.to_time if start_date.respond_to?(:to_time) 9 | end_time = end_date.to_time if end_date.respond_to?(:to_time) 10 | distance_in_seconds = ((end_time - start_time).abs).round 11 | 12 | components = get_time_diff_components(%w(year month week day hour minute second), distance_in_seconds) 13 | time_diff_components = {:year => components[0], :month => components[1], :week => components[2], :day => components[3], :hour => components[4], :minute => components[5], :second => components[6]} 14 | 15 | formatted_intervals = get_formatted_intervals(format_string) 16 | components = get_time_diff_components(formatted_intervals, distance_in_seconds) 17 | formatted_components = create_formatted_component_hash(components, formatted_intervals) 18 | format_string = remove_format_string_for_zero_components(formatted_components, format_string) 19 | time_diff_components[:diff] = format_date_time(formatted_components, format_string) unless format_string.nil? 20 | return time_diff_components 21 | end 22 | 23 | def self.get_formatted_intervals(format_string) 24 | intervals = [] 25 | [{'year' => '%y'}, {'month' => '%M'}, {'week' => '%w'}, {'day' => '%d'}].each do |component| 26 | key = component.keys.first 27 | value = component.values.first 28 | intervals << key if format_string.include?(value) 29 | end 30 | intervals << 'hour' if format_string.include?('%h') || format_string.include?('%H') 31 | intervals << 'minute' if format_string.include?('%m') || format_string.include?('%N') 32 | intervals << 'second' if format_string.include?('%s') || format_string.include?('%S') 33 | intervals 34 | end 35 | 36 | def self.create_formatted_component_hash(components, formatted_intervals) 37 | formatted_components = {} 38 | index = 0 39 | components.each do |component| 40 | formatted_components[:"#{formatted_intervals[index]}"] = component 41 | index = index + 1 42 | end 43 | formatted_components 44 | end 45 | 46 | def self.get_time_diff_components(intervals, distance_in_seconds) 47 | components = [] 48 | intervals.each do |interval| 49 | component = (distance_in_seconds / 1.send(interval)).floor 50 | distance_in_seconds -= component.send(interval) 51 | components << component 52 | end 53 | components 54 | end 55 | 56 | def Time.format_date_time(time_diff_components, format_string) 57 | [{:year => '%y'}, {:month => '%M'}, {:week => '%w'}, {:day => '%d'}, {:hour => '%H'}, {:minute => '%N'}, {:second => '%S'}].each do |component| 58 | key = component.keys.first 59 | value = component.values.first 60 | format_string.gsub!(value, "#{time_diff_components[key]} #{pluralize(key.to_s, time_diff_components[key])}") if time_diff_components[key] 61 | end 62 | [{:hour => '%h'},{:minute => '%m'},{:second => '%s'}].each do |component| 63 | key = component.keys.first 64 | value = component.values.first 65 | format_string.gsub!(value, format_digit(time_diff_components[key]).to_s) if time_diff_components[key] 66 | end 67 | format_string 68 | end 69 | 70 | def Time.pluralize(word, count) 71 | return count != 1 ? I18n.t(word.pluralize, :default => word.pluralize) : I18n.t(word, :default => word) 72 | end 73 | 74 | def Time.remove_format_string_for_zero_components(time_diff_components, format_string) 75 | [{:year => '%y'}, {:month => '%M'}, {:week => '%w'}].each do |component| 76 | key = component.keys.first 77 | value = component.values.first 78 | format_string.gsub!("#{value}, ",'') if time_diff_components[key] == 0 79 | end 80 | if time_diff_components[:day] == 0 81 | (format_string.slice(0..1) == '%d')? format_string.gsub!('%d ','') : format_string.gsub!(', %d','') 82 | end 83 | format_string.slice!(0..3) if format_string.slice(0..3) == 'and ' 84 | format_string 85 | end 86 | 87 | def Time.format_digit(number) 88 | return '%02d' % number 89 | end 90 | end 91 | -------------------------------------------------------------------------------- /test/helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'bundler' 3 | #require 'coveralls' 4 | #Coveralls.wear! 5 | 6 | begin 7 | Bundler.setup(:default, :development) 8 | rescue Bundler::BundlerError => e 9 | $stderr.puts e.message 10 | $stderr.puts "Run `bundle install` to install missing gems" 11 | exit e.status_code 12 | end 13 | require 'test/unit' 14 | require 'shoulda' 15 | 16 | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) 17 | $LOAD_PATH.unshift(File.dirname(__FILE__)) 18 | require 'time_diff' 19 | 20 | class Test::Unit::TestCase 21 | end 22 | -------------------------------------------------------------------------------- /test/test_time_diff.rb: -------------------------------------------------------------------------------- 1 | require 'helper' 2 | require 'time' 3 | 4 | class TestTimeDiff < Test::Unit::TestCase 5 | should "return the time differnce in displayable format" do 6 | assert_test_scenarios(Time.parse('2011-03-06'), Time.parse('2011-03-07'), {:year => 0, :month => 0, :week => 0, :day => 1, :hour => 0, :minute => 0, :second => 0, :diff => '1 day and 00:00:00'}) 7 | assert_test_scenarios(Time.parse('2011-03-06'), Time.parse('2011-04-08'), {:year => 0, :month => 1, :week => 0, :day => 3, :hour => 0, :minute => 0, :second => 0, :diff => '1 month, 3 days and 00:00:00'}) 8 | assert_test_scenarios(Time.parse('2011-03-06 12:30:00'), Time.parse('2011-03-07 12:30:30'), {:year => 0, :month => 0, :week => 0, :day => 1, :hour => 0, :minute => 0, :second => 30, :diff => '1 day and 00:00:30'}) 9 | assert_test_scenarios(Time.parse('2011-03-06'), Time.parse('2013-03-07'), {:year => 2, :month => 0, :week => 0, :day => 1, :hour => 12, :minute => 0, :second => 0, :diff => '2 years, 1 day and 12:00:00'}) 10 | assert_test_scenarios(Time.parse('2011-03-06'), Time.parse('2011-03-14'), {:year => 0, :month => 0, :week => 1, :day => 1, :hour => 0, :minute => 0, :second => 0, :diff => '1 week, 1 day and 00:00:00'}) 11 | assert_test_scenarios(Time.parse('2011-03-06 12:30:00'), Time.parse('2011-03-06 12:30:30'), {:year => 0, :month => 0, :week => 0, :day => 0, :hour => 0, :minute => 0, :second => 30, :diff => '00:00:30'}) 12 | end 13 | 14 | should "return the time difference in a formatted text" do 15 | assert_test_scenarios_for_formatted_diff(Time.parse('2010-03-06 12:30:00'), Time.parse('2011-03-07 12:30:30'), '%y, %d and %h:%m:%s', '1 year and 18:00:30') 16 | assert_test_scenarios_for_formatted_diff(Time.parse('2010-03-06 12:30:00'), Time.parse('2011-03-07 12:30:30'), '%d %H %N %S', '366 days 0 hours 0 minutes 30 seconds') 17 | assert_test_scenarios_for_formatted_diff(Time.parse('2011-03-06 12:30:00'), Time.parse('2011-03-07 12:30:30'), '%H %N %S', '24 hours 0 minutes 30 seconds') 18 | end 19 | 20 | def assert_test_scenarios(start_date, end_date, expected_result) 21 | date_diff = Time.diff(start_date, end_date) 22 | assert_equal(date_diff, expected_result) 23 | end 24 | 25 | def assert_test_scenarios_for_formatted_diff(start_date, end_date, format_string, expected_result) 26 | date_diff = Time.diff(start_date, end_date, format_string) 27 | assert_equal(date_diff[:diff], expected_result) 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /time_diff.gemspec: -------------------------------------------------------------------------------- 1 | # Generated by jeweler 2 | # DO NOT EDIT THIS FILE DIRECTLY 3 | # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' 4 | # -*- encoding: utf-8 -*- 5 | 6 | Gem::Specification.new do |s| 7 | s.name = %q{time_diff} 8 | s.version = "0.3.0" 9 | 10 | s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= 11 | s.authors = [%q{abhilash}] 12 | s.date = %q{2012-11-13} 13 | s.description = %q{It returns a hash file with the difference in terms of year, month, week, day, hour, minute and second} 14 | s.email = %q{abhidsm@gmail.com} 15 | s.extra_rdoc_files = [ 16 | "LICENSE.txt", 17 | "README", 18 | "README.rdoc" 19 | ] 20 | s.files = [ 21 | ".document", 22 | "Gemfile", 23 | "Gemfile.lock", 24 | "LICENSE.txt", 25 | "README", 26 | "README.rdoc", 27 | "Rakefile", 28 | "VERSION", 29 | "lib/en.yml", 30 | "lib/time_diff.rb", 31 | "test/helper.rb", 32 | "test/test_time_diff.rb", 33 | "time_diff.gemspec" 34 | ] 35 | s.homepage = %q{http://github.com/abhidsm/time_diff} 36 | s.licenses = [%q{MIT}] 37 | s.require_paths = [%q{lib}] 38 | s.rubygems_version = %q{1.8.6} 39 | s.summary = %q{Gem to get the difference between two time} 40 | s.test_files = [ 41 | "test/helper.rb", 42 | "test/test_time_diff.rb" 43 | ] 44 | 45 | if s.respond_to? :specification_version then 46 | s.specification_version = 3 47 | 48 | if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then 49 | s.add_runtime_dependency(%q, [">= 0"]) 50 | s.add_runtime_dependency(%q, [">= 0"]) 51 | s.add_development_dependency(%q, [">= 0"]) 52 | s.add_development_dependency(%q, ["~> 1.0.0"]) 53 | s.add_development_dependency(%q, ["~> 1.5.2"]) 54 | s.add_development_dependency(%q, [">= 0"]) 55 | else 56 | s.add_dependency(%q, [">= 0"]) 57 | s.add_dependency(%q, [">= 0"]) 58 | s.add_dependency(%q, [">= 0"]) 59 | s.add_dependency(%q, ["~> 1.0.0"]) 60 | s.add_dependency(%q, ["~> 1.5.2"]) 61 | s.add_dependency(%q, [">= 0"]) 62 | end 63 | else 64 | s.add_dependency(%q, [">= 0"]) 65 | s.add_dependency(%q, [">= 0"]) 66 | s.add_dependency(%q, [">= 0"]) 67 | s.add_dependency(%q, ["~> 1.0.0"]) 68 | s.add_dependency(%q, ["~> 1.5.2"]) 69 | s.add_dependency(%q, [">= 0"]) 70 | end 71 | end 72 | 73 | --------------------------------------------------------------------------------