stamped 0.1.0

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: ccb6aab236ff833114af9f3b85326dc4d552dc29
4
+ data.tar.gz: 403ee84944880cb29ea8fc6d084b5b4d2cd3f7bf
5
+ SHA512:
6
+ metadata.gz: 105623246d9d22a06c010c7f60db9adf6caa336a7ec649da2623ac27d534569b75d4bddb644cd9c640090bc918eac3e12746a22ac2fd1dbe1083130fad9ad6a2
7
+ data.tar.gz: 09ea5c8ba60b7ada473c62ba8eb4607c2ae17981e64339dcbdca777a8183b4d96176b7367a08d71d70005a661ad36f31fe56953eabe90d6d3851a70f9b41bbd5
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,97 @@
1
+ # Common configuration.
2
+ AllCops:
3
+ # Include gemspec and Rakefile
4
+ Include:
5
+ - '**/*.gemspec'
6
+ - '**/Rakefile'
7
+ - '**/*.rake'
8
+ - '**/Gemfile'
9
+ Exclude:
10
+ - 'vendor/**'
11
+ - 'spec/fixtures/**'
12
+ RunRailsCops: true
13
+
14
+ # Indent private/protected/public as deep as method definitions
15
+ AccessModifierIndentation:
16
+ EnforcedStyle: outdent
17
+ SupportedStyles:
18
+ - outdent
19
+ - indent
20
+
21
+ # Indentation of `when`.
22
+ CaseIndentation:
23
+ IndentWhenRelativeTo: end
24
+ SupportedStyles:
25
+ - case
26
+ - end
27
+ IndentOneStep: false
28
+
29
+ ClassLength:
30
+ CountComments: false # count full line comments?
31
+ Max: 200
32
+
33
+ # Align ends correctly.
34
+ EndAlignment:
35
+ # The value `keyword` means that `end` should be aligned with the matching
36
+ # keyword (if, while, etc.).
37
+ # The value `variable` means that in assignments, `end` should be aligned
38
+ # with the start of the variable on the left hand side of `=`. In all other
39
+ # situations, `end` should still be aligned with the keyword.
40
+ AlignWith: variable
41
+ SupportedStyles:
42
+ - keyword
43
+ - variable
44
+
45
+ # Built-in global variables are allowed by default.
46
+ GlobalVars:
47
+ AllowedVariables: ['$1', '$2', '$3', '$4', '$5', '$6']
48
+
49
+ LineLength:
50
+ Max: 120
51
+
52
+ MethodLength:
53
+ CountComments: false # count full line comments?
54
+ Max: 20
55
+
56
+ NumericLiterals:
57
+ MinDigits: 10
58
+
59
+ SignalException:
60
+ EnforcedStyle: only_raise
61
+ SupportedStyles:
62
+ - only_raise
63
+ - only_fail
64
+ - semantic
65
+
66
+ SpaceBeforeBlockBraces:
67
+ EnforcedStyle: no_space
68
+ SupportedStyles:
69
+ - space
70
+ - no_space
71
+
72
+ SpaceInsideBlockBraces:
73
+ EnforcedStyle: no_space
74
+ SupportedStyles:
75
+ - space
76
+ - no_space
77
+ # Valid values are: space, no_space
78
+ EnforcedStyleForEmptyBraces: no_space
79
+ # Space between { and |. Overrides EnforcedStyle if there is a conflict.
80
+ SpaceBeforeBlockParameters: false
81
+
82
+ SpaceInsideHashLiteralBraces:
83
+ EnforcedStyle: no_space
84
+ EnforcedStyleForEmptyBraces: no_space
85
+ SupportedStyles:
86
+ - space
87
+ - no_space
88
+
89
+ # Checks whether the source file has a utf-8 encoding comment or not
90
+ Encoding:
91
+ EnforcedStyle: when_needed
92
+ SupportedStyles:
93
+ - when_needed
94
+ - always
95
+
96
+ WordArray:
97
+ MinSize: 0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in stamped.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Allen Madsen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Stamped
2
+
3
+ This gem extends Time with a couple useful methods for dealing with iso8601 encoded times in UTC.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'stamped'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install stamped
20
+
21
+ ## Usage
22
+
23
+ ``` ruby
24
+ Time.stamp #=> "2015-03-25T00:52:34Z"
25
+ Time.stamp(Time.at(0)) #=> "1970-01-01T00:00:00Z"
26
+ Time.from_stamp("2015-03-25T00:52:34Z") #=> 2015-03-25 00:52:34 UTC
27
+ Time.now.stamp #=> "2015-03-25T00:53:36Z"
28
+ Time.stamp_time #=> 2015-03-25 00:53:44 UTC
29
+ ```
30
+
31
+ ## Development
32
+
33
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
34
+
35
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
36
+
37
+ ## Contributing
38
+
39
+ 1. Fork it ( https://github.com/lintci/stamped/fork )
40
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
41
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
42
+ 4. Push to the branch (`git push origin my-new-feature`)
43
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'stamped'
5
+ require 'pry'
6
+
7
+ Pry.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,4 @@
1
+ # Stamped version
2
+ module Stamped
3
+ VERSION = '0.1.0'
4
+ end
data/lib/stamped.rb ADDED
@@ -0,0 +1,30 @@
1
+ require 'time'
2
+ require 'stamped/version'
3
+
4
+ # Useful extensions for converting time to and from iso8601 in UTC
5
+ module Stamped
6
+ def self.included(base)
7
+ base.extend(ClassMethods)
8
+ end
9
+
10
+ def stamp
11
+ utc.iso8601
12
+ end
13
+
14
+ # Class methods for time
15
+ module ClassMethods
16
+ def from_stamp(timestamp)
17
+ Time.iso8601(timestamp)
18
+ end
19
+
20
+ def stamp(time = now)
21
+ time.stamp
22
+ end
23
+
24
+ def stamp_time
25
+ from_stamp(stamp)
26
+ end
27
+ end
28
+ end
29
+
30
+ Time.include(Stamped)
data/stamped.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'stamped/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'stamped'
8
+ spec.version = Stamped::VERSION
9
+ spec.authors = ['Allen Madsen']
10
+ spec.email = ['blatyo@gmail.com']
11
+
12
+ spec.summary = 'Time extension for dealing with timestamps.'
13
+ spec.description = 'This gem extends Time with a couple useful methods for dealing with iso8601 encoded times in UTC.'
14
+ spec.homepage = 'https://github.com/lintci/stamped'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject{|f| f.match(%r{^(test|spec|features)/})}
18
+ spec.bindir = 'exe'
19
+ spec.executables = spec.files.grep(%r{^exe/}){|f| File.basename(f)}
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.9'
23
+ spec.add_development_dependency 'rake', '~> 10.0'
24
+ spec.add_development_dependency 'rspec'
25
+ spec.add_development_dependency 'pry-byebug'
26
+ spec.add_development_dependency 'timecop'
27
+ end
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stamped
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Allen Madsen
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-03-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry-byebug
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: timecop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: This gem extends Time with a couple useful methods for dealing with iso8601
84
+ encoded times in UTC.
85
+ email:
86
+ - blatyo@gmail.com
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".rubocop.yml"
94
+ - Gemfile
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - bin/console
99
+ - bin/setup
100
+ - lib/stamped.rb
101
+ - lib/stamped/version.rb
102
+ - stamped.gemspec
103
+ homepage: https://github.com/lintci/stamped
104
+ licenses:
105
+ - MIT
106
+ metadata: {}
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ requirements: []
122
+ rubyforge_project:
123
+ rubygems_version: 2.4.6
124
+ signing_key:
125
+ specification_version: 4
126
+ summary: Time extension for dealing with timestamps.
127
+ test_files: []