everything_becomes_f 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: 35cdb9dde179d6606be6fd74da23c3767c10f754
4
+ data.tar.gz: 56daedeadf4cfa80b63fc7fa55afc49e04615523
5
+ SHA512:
6
+ metadata.gz: 90ac9bad61792b0c6b276513f9cf9a6cbdcc38f3e7b079aba281c5c5199af61a2785fd04fce980e1658542e69568925b9469baa2c7069c115f9cf66db0458093
7
+ data.tar.gz: 17cf3b3b544111e4d942b968264fb1ddf1d74e906a6a78d44bf41b8d6081593a9a637e06b4fa50b56e5cb914f81ec6c764706a9a90b5ba03804a4602f5e05c75
data/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ *.sw*
16
+ .rspec
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
4
+ before_install: gem install bundler -v 1.10.6
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in everything_becomes_f.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 ryoff
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,118 @@
1
+ # EverythingBecomesF
2
+
3
+ https://ja.wikipedia.org/wiki/すべてがFになる
4
+
5
+ https://en.wikipedia.org/wiki/Subete_ga_F_ni_Naru
6
+
7
+ このgemは、ゲーム化・漫画化・アニメ化・ドラマ化などもされた森博嗣のミステリー小説【すべてがFになる】に触発されて、
8
+
9
+ すべてがfになる `everything_becomes_f` method と
10
+
11
+ すべてがfになったか、を判定する `everything_became_f?` method
12
+
13
+ だけを提供するネタgemです。
14
+
15
+ ## Installation
16
+
17
+ Add this line to your application's Gemfile:
18
+
19
+ ```ruby
20
+ gem 'everything_becomes_f'
21
+ ```
22
+
23
+ And then execute:
24
+
25
+ $ bundle
26
+
27
+ Or install it yourself as:
28
+
29
+ $ gem install everything_becomes_f
30
+
31
+ ## Usage
32
+ ### everything_became_f?
33
+
34
+ integer
35
+
36
+ ````ruby
37
+ 1.everything_became_f? # => false
38
+ 14.everything_became_f? # => false
39
+ 15.everything_became_f? # => true
40
+ 16.everything_became_f? # => false
41
+ 255.everything_became_f? # => true
42
+
43
+ 65534.to_s(16) # => "fffe"
44
+ 65534.everything_became_f? # => false
45
+ 65535.to_s(16) # => "ffff"
46
+ 65535.everything_became_f? # => true
47
+ ```
48
+
49
+ String
50
+
51
+ ````ruby
52
+ 'f'.everything_became_f? # => true
53
+ 'fF'.everything_became_f? # => true
54
+ 'FF'.everything_became_f? # => true
55
+ 'ffffffffffffffffffffffffffffffffffffffffffffffffff'.everything_became_f? # => true
56
+ 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'.everything_became_f? # => true
57
+ ```
58
+
59
+ Time
60
+
61
+ ````ruby
62
+ ENV['TZ'] = 'UTC'
63
+ Time.new(1970, 1, 1, 0, 0, 15).everything_became_f? # => true
64
+ Time.new(1978, 7, 4, 21, 24, 15).everything_became_f? # => true
65
+
66
+ Time.new(2106, 2, 7, 6, 28, 14).to_i.to_s(16) # => "fffffffe"
67
+ Time.new(2106, 2, 7, 6, 28, 14).everything_became_f? # => false
68
+ Time.new(2106, 2, 7, 6, 28, 15).to_i.to_s(16) # => "ffffffff"
69
+ Time.new(2106, 2, 7, 6, 28, 15).everything_became_f? # => true
70
+ ```
71
+
72
+ ### everything_becomes_f
73
+
74
+ Integer
75
+
76
+ ````ruby
77
+ 0.everything_becomes_f # => 15
78
+ 1.everything_becomes_f # => 15
79
+ 10.everything_becomes_f # => 15
80
+ 15.everything_becomes_f # => 15
81
+ 16.everything_becomes_f # => 255
82
+ 254.everything_becomes_f # => 255
83
+ 255.everything_becomes_f # => 255
84
+ 256.everything_becomes_f # => 4095
85
+ 65534.everything_becomes_f # => 65535
86
+ 65535.everything_becomes_f # => 65535
87
+ ```
88
+
89
+ String
90
+
91
+ ````ruby
92
+ 'a'.everything_becomes_f # => 'f'
93
+ 'af'.everything_becomes_f # => 'ff'
94
+ 'fa'.everything_becomes_f # => 'ff'
95
+ 'ffffffffffffffffffffffffffffffffffffffffffffffffffe'.everything_becomes_f # => 'fffffffffffffffffffffffffffffffffffffffffffffffffff'
96
+ 'あいうえお'.everything_becomes_f # => 'fffff'
97
+ ```
98
+
99
+ Time
100
+
101
+ ````ruby
102
+ Time.new(1970, 1, 1, 0, 0, 14).everything_becomes_f # => Time.new(1970, 1, 1, 0, 0, 15)
103
+ Time.new(1970, 1, 1, 0, 0, 15).everything_becomes_f # => Time.new(1970, 1, 1, 0, 0, 15)
104
+ Time.new(1970, 1, 1, 0, 0, 16).everything_becomes_f # => Time.new(1970, 1, 1, 0, 4, 15)
105
+ Time.new(1978, 7, 4, 21, 24, 14).everything_becomes_f # => Time.new(1978, 7, 4, 21, 24, 15)
106
+ Time.new(1978, 7, 4, 21, 24, 15).everything_becomes_f # => Time.new(1978, 7, 4, 21, 24, 15)
107
+ Time.new(1978, 7, 4, 21, 24, 16).everything_becomes_f # => Time.new(2106, 2, 7, 6, 28, 15)
108
+ ```
109
+
110
+ ## Contributing
111
+
112
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/everything_becomes_f. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
113
+
114
+
115
+ ## License
116
+
117
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
118
+
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,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "everything_becomes_f"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.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,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'everything_becomes_f/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "everything_becomes_f"
8
+ spec.version = EverythingBecomesF::VERSION
9
+ spec.authors = ["ryoff"]
10
+ spec.email = ["ryoffes@gmail.com"]
11
+
12
+ spec.summary = %q{Everything becomes f.}
13
+ spec.description = %q{Everything becomes f.}
14
+ spec.homepage = "https://github.com/ryoff/everything_becomes_f"
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.10"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec"
25
+ spec.add_development_dependency "rspec-parameterized"
26
+ end
@@ -0,0 +1,4 @@
1
+ require "everything_becomes_f/version"
2
+ require "everything_becomes_f/core_ext/string"
3
+ require "everything_becomes_f/core_ext/time"
4
+ require "everything_becomes_f/core_ext/integer"
@@ -0,0 +1,12 @@
1
+ class Integer
2
+ def everything_became_f?
3
+ to_s(16).squeeze == 'f'
4
+ end
5
+
6
+ def everything_becomes_f
7
+ return self if everything_became_f?
8
+
9
+ ('f' * to_s(16).length).hex
10
+ end
11
+ end
12
+
@@ -0,0 +1,13 @@
1
+ class String
2
+ def everything_became_f?
3
+ downcase.squeeze == 'f'
4
+ end
5
+
6
+ def everything_becomes_f
7
+ 'f' * length
8
+ end
9
+
10
+ def everything_becomes_f!
11
+ self.replace(everything_becomes_f)
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ class Time
2
+ def everything_became_f?
3
+ to_i.everything_became_f?
4
+ end
5
+
6
+ def everything_becomes_f
7
+ return self if everything_became_f?
8
+
9
+ Time.at(to_i.everything_becomes_f)
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module EverythingBecomesF
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: everything_becomes_f
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - ryoff
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-12-17 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.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
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: rspec-parameterized
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
+ description: Everything becomes f.
70
+ email:
71
+ - ryoffes@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
+ - CODE_OF_CONDUCT.md
80
+ - Gemfile
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - bin/console
85
+ - bin/setup
86
+ - everything_becomes_f.gemspec
87
+ - lib/everything_becomes_f.rb
88
+ - lib/everything_becomes_f/core_ext/integer.rb
89
+ - lib/everything_becomes_f/core_ext/string.rb
90
+ - lib/everything_becomes_f/core_ext/time.rb
91
+ - lib/everything_becomes_f/version.rb
92
+ homepage: https://github.com/ryoff/everything_becomes_f
93
+ licenses:
94
+ - MIT
95
+ metadata: {}
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ requirements: []
111
+ rubyforge_project:
112
+ rubygems_version: 2.2.0
113
+ signing_key:
114
+ specification_version: 4
115
+ summary: Everything becomes f.
116
+ test_files: []