mure 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e9ba52e272a15a18b0e96e39727886bf2a1d0970c28cb236f7f4778651b23e16
4
+ data.tar.gz: '07984f3285468649290f4cec3f9a935dbc7ae4ca4901a03c4d354e55ae9cb042'
5
+ SHA512:
6
+ metadata.gz: c205618ef9732f2fa6a058fdf70900502a241e28ce9456c6f950ff59027d9f739ca2aa7cc888b175e51c202cfcd645828d8d90623c1f1d2a687f624f645c622e
7
+ data.tar.gz: e63f5600ddf70b2af9648d70645f7f79b52a01812eb1b1c0fdd634cbbffbb413c796babd96a2ad940333ef547d2b5d10333596a7fd23e61da22c08272fff39a7
@@ -0,0 +1,9 @@
1
+ version: 2
2
+ jobs:
3
+ build:
4
+ docker:
5
+ - image: circleci/ruby:2.5.1
6
+ steps:
7
+ - checkout
8
+ - run: bundle install
9
+ - run: bundle exec rake spec
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format FoodFormatter
2
+ --require spec_helper
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at taki@users.noreply.github.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in mure.gemspec
6
+ gemspec
@@ -0,0 +1,85 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ mure (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ abstract_type (0.0.7)
10
+ adamantium (0.2.0)
11
+ ice_nine (~> 0.11.0)
12
+ memoizable (~> 0.4.0)
13
+ ast (2.4.0)
14
+ binding_of_caller (0.8.0)
15
+ debug_inspector (>= 0.0.1)
16
+ byebug (10.0.2)
17
+ coderay (1.1.2)
18
+ concord (0.1.5)
19
+ adamantium (~> 0.2.0)
20
+ equalizer (~> 0.0.9)
21
+ debug_inspector (0.0.3)
22
+ diff-lcs (1.3)
23
+ equalizer (0.0.11)
24
+ food_formatter (0.1.0)
25
+ ice_nine (0.11.2)
26
+ memoizable (0.4.2)
27
+ thread_safe (~> 0.3, >= 0.3.1)
28
+ method_source (0.9.0)
29
+ parser (2.5.1.0)
30
+ ast (~> 2.4.0)
31
+ proc_to_ast (0.1.0)
32
+ coderay
33
+ parser
34
+ unparser
35
+ procto (0.0.3)
36
+ pry (0.11.3)
37
+ coderay (~> 1.1.0)
38
+ method_source (~> 0.9.0)
39
+ pry-byebug (3.6.0)
40
+ byebug (~> 10.0)
41
+ pry (~> 0.10)
42
+ rake (10.5.0)
43
+ rspec (3.7.0)
44
+ rspec-core (~> 3.7.0)
45
+ rspec-expectations (~> 3.7.0)
46
+ rspec-mocks (~> 3.7.0)
47
+ rspec-core (3.7.1)
48
+ rspec-support (~> 3.7.0)
49
+ rspec-expectations (3.7.0)
50
+ diff-lcs (>= 1.2.0, < 2.0)
51
+ rspec-support (~> 3.7.0)
52
+ rspec-mocks (3.7.0)
53
+ diff-lcs (>= 1.2.0, < 2.0)
54
+ rspec-support (~> 3.7.0)
55
+ rspec-parameterized (0.4.0)
56
+ binding_of_caller
57
+ parser
58
+ proc_to_ast
59
+ rspec (>= 2.13, < 4)
60
+ unparser
61
+ rspec-support (3.7.1)
62
+ thread_safe (0.3.6)
63
+ unparser (0.2.7)
64
+ abstract_type (~> 0.0.7)
65
+ adamantium (~> 0.2.0)
66
+ concord (~> 0.1.5)
67
+ diff-lcs (~> 1.3)
68
+ equalizer (~> 0.0.9)
69
+ parser (>= 2.3.1.2, < 2.6)
70
+ procto (~> 0.0.2)
71
+
72
+ PLATFORMS
73
+ ruby
74
+
75
+ DEPENDENCIES
76
+ bundler (~> 1.16)
77
+ food_formatter
78
+ mure!
79
+ pry-byebug
80
+ rake (~> 10.0)
81
+ rspec (~> 3.0)
82
+ rspec-parameterized
83
+
84
+ BUNDLED WITH
85
+ 1.16.1
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 taki
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.
@@ -0,0 +1,25 @@
1
+ # Mure
2
+
3
+ [![CircleCI](https://circleci.com/gh/taki/mure.svg?style=svg)](https://circleci.com/gh/taki/mure)
4
+
5
+ You can encode Base64.
6
+
7
+ ## Requirements
8
+
9
+ - Ruby 2.5.1 or higher
10
+
11
+ ## Instlattion
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'mure'
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```ruby
22
+ require 'mure'
23
+
24
+ Mure.encode64('abcdefg') # => 'YWJjZGVmZw=='
25
+ ```
@@ -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
@@ -0,0 +1,87 @@
1
+ require 'mure/version'
2
+
3
+ module Mure
4
+ TABLE = {
5
+ '000000' => 'A',
6
+ '000001' => 'B',
7
+ '000010' => 'C',
8
+ '000011' => 'D',
9
+ '000100' => 'E',
10
+ '000101' => 'F',
11
+ '000110' => 'G',
12
+ '000111' => 'H',
13
+ '001000' => 'I',
14
+ '001001' => 'J',
15
+ '001010' => 'K',
16
+ '001011' => 'L',
17
+ '001100' => 'M',
18
+ '001101' => 'N',
19
+ '001110' => 'O',
20
+ '001111' => 'P',
21
+ '010000' => 'Q',
22
+ '010001' => 'R',
23
+ '010010' => 'S',
24
+ '010011' => 'T',
25
+ '010100' => 'U',
26
+ '010101' => 'V',
27
+ '010110' => 'W',
28
+ '010111' => 'X',
29
+ '011000' => 'Y',
30
+ '011001' => 'Z',
31
+ '011010' => 'a',
32
+ '011011' => 'b',
33
+ '011100' => 'c',
34
+ '011101' => 'd',
35
+ '011110' => 'e',
36
+ '011111' => 'f',
37
+ '100000' => 'g',
38
+ '100001' => 'h',
39
+ '100010' => 'i',
40
+ '100011' => 'j',
41
+ '100100' => 'k',
42
+ '100101' => 'l',
43
+ '100110' => 'm',
44
+ '100111' => 'n',
45
+ '101000' => 'o',
46
+ '101001' => 'p',
47
+ '101010' => 'q',
48
+ '101011' => 'r',
49
+ '101100' => 's',
50
+ '101101' => 't',
51
+ '101110' => 'u',
52
+ '101111' => 'v',
53
+ '110000' => 'w',
54
+ '110001' => 'x',
55
+ '110010' => 'y',
56
+ '110011' => 'z',
57
+ '110100' => '0',
58
+ '110101' => '1',
59
+ '110110' => '2',
60
+ '110111' => '3',
61
+ '111000' => '4',
62
+ '111001' => '5',
63
+ '111010' => '6',
64
+ '111011' => '7',
65
+ '111100' => '8',
66
+ '111101' => '9',
67
+ '111110' => '+',
68
+ '111111' => '/'
69
+ }.freeze
70
+
71
+ def self.encode64(text)
72
+ # NOTE: String#unpackは、エンディアンに依存しそう。。。
73
+ binary_text = text.unpack('B*')[0]
74
+ loop do
75
+ break if (binary_text.size % 6).zero?
76
+ binary_text << '0'
77
+ end
78
+
79
+ encoded_text = binary_text.each_char.each_slice(6).map { |str| TABLE.fetch(str.join) }.join
80
+ loop do
81
+ break if (encoded_text.size % 4).zero?
82
+ encoded_text << '='
83
+ end
84
+
85
+ encoded_text
86
+ end
87
+ end
@@ -0,0 +1,3 @@
1
+ module Mure
2
+ VERSION = '0.1.0'.freeze
3
+ end
@@ -0,0 +1,26 @@
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'mure/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'mure'
7
+ spec.version = Mure::VERSION
8
+ spec.authors = ['taki']
9
+ spec.email = ['taki@users.noreply.github.com']
10
+
11
+ spec.summary = 'Encode Base64'
12
+ spec.description = spec.summary
13
+ spec.homepage = 'https://github.com/taki/mure'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/}) }
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.add_development_dependency 'bundler', '~> 1.16'
21
+ spec.add_development_dependency 'food_formatter'
22
+ spec.add_development_dependency 'pry-byebug'
23
+ spec.add_development_dependency 'rake', '~> 10.0'
24
+ spec.add_development_dependency 'rspec', '~> 3.0'
25
+ spec.add_development_dependency 'rspec-parameterized'
26
+ end
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mure
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - taki
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-05-03 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.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: food_formatter
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry-byebug
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: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-parameterized
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Encode Base64
98
+ email:
99
+ - taki@users.noreply.github.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".circleci/config.yml"
105
+ - ".gitignore"
106
+ - ".rspec"
107
+ - CODE_OF_CONDUCT.md
108
+ - Gemfile
109
+ - Gemfile.lock
110
+ - LICENSE.txt
111
+ - README.md
112
+ - Rakefile
113
+ - lib/mure.rb
114
+ - lib/mure/version.rb
115
+ - mure.gemspec
116
+ homepage: https://github.com/taki/mure
117
+ licenses:
118
+ - MIT
119
+ metadata: {}
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ requirements: []
135
+ rubyforge_project:
136
+ rubygems_version: 2.7.6
137
+ signing_key:
138
+ specification_version: 4
139
+ summary: Encode Base64
140
+ test_files: []