good_luck_charm 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cf57e902e586b14e4271b101f8b3d8998199552aa4f86b56267c8adc3c4c9805
4
+ data.tar.gz: 3ef6726567fb65da762c09aab597734ffa2945067af6df6c68d7c77c018501ec
5
+ SHA512:
6
+ metadata.gz: c1cf079ab333326583cff5a46a103f944e76bd7e413a3f369ce84c699c18cf6a938193ecccc4f791c7083b362f6ca70692e8fb5e9e8205f810649177fe77c6c0
7
+ data.tar.gz: 6dbef181762e4c5422ad1828fe097f97e9a0d2b042ba237e36cf356a301553237e3e8ea4b2da3e3aca53e93f1b66d10a5dd1065f9f51fcee0b7dd721f80a0cc5
data/.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ # デフォルトの無視対象ファイル
2
+ /shelf/
3
+ /workspace.xml
4
+ # エディターベースの HTTP クライアントリクエスト
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
@@ -0,0 +1,68 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ </content>
12
+ <orderEntry type="jdk" jdkName="rbenv: 3.1.0" jdkType="RUBY_SDK" />
13
+ <orderEntry type="sourceFolder" forTests="false" />
14
+ <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, rbenv: 3.1.0) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.3.15, rbenv: 3.1.0) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.0, rbenv: 3.1.0) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="parallel (v1.22.1, rbenv: 3.1.0) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="parser (v3.1.2.0, rbenv: 3.1.0) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, rbenv: 3.1.0) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, rbenv: 3.1.0) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.5.0, rbenv: 3.1.0) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, rbenv: 3.1.0) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="rounding (v1.0.1, rbenv: 3.1.0) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.11.0, rbenv: 3.1.0) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.11.0, rbenv: 3.1.0) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.11.0, rbenv: 3.1.0) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.11.1, rbenv: 3.1.0) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.11.0, rbenv: 3.1.0) [gem]" level="application" />
29
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.30.1, rbenv: 3.1.0) [gem]" level="application" />
30
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.18.0, rbenv: 3.1.0) [gem]" level="application" />
31
+ <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, rbenv: 3.1.0) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="timecop (v0.9.5, rbenv: 3.1.0) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.1.0, rbenv: 3.1.0) [gem]" level="application" />
34
+ </component>
35
+ <component name="RakeTasksCache">
36
+ <option name="myRootTask">
37
+ <RakeTaskImpl id="rake">
38
+ <subtasks>
39
+ <RakeTaskImpl description="Build good_luck_charm-0.1.0.gem into the pkg directory" fullCommand="build" id="build" />
40
+ <RakeTaskImpl id="build">
41
+ <subtasks>
42
+ <RakeTaskImpl description="Generate SHA512 checksum if good_luck_charm-0.1.0.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
43
+ </subtasks>
44
+ </RakeTaskImpl>
45
+ <RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
46
+ <RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
47
+ <RakeTaskImpl description="Build and install good_luck_charm-0.1.0.gem into system gems" fullCommand="install" id="install" />
48
+ <RakeTaskImpl id="install">
49
+ <subtasks>
50
+ <RakeTaskImpl description="Build and install good_luck_charm-0.1.0.gem into system gems without network access" fullCommand="install:local" id="local" />
51
+ </subtasks>
52
+ </RakeTaskImpl>
53
+ <RakeTaskImpl description="Create tag v0.1.0 and build and push good_luck_charm-0.1.0.gem to" fullCommand="release[remote]" id="release[remote]" />
54
+ <RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
55
+ <RakeTaskImpl description="" fullCommand="default" id="default" />
56
+ <RakeTaskImpl description="" fullCommand="release" id="release" />
57
+ <RakeTaskImpl id="release">
58
+ <subtasks>
59
+ <RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
60
+ <RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
61
+ <RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
62
+ </subtasks>
63
+ </RakeTaskImpl>
64
+ </subtasks>
65
+ </RakeTaskImpl>
66
+ </option>
67
+ </component>
68
+ </module>
@@ -0,0 +1,15 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Rubocop" enabled="true" level="WARNING" enabled_by_default="true">
5
+ <option name="myRunRubocopOnSave" value="true" />
6
+ </inspection_tool>
7
+ <inspection_tool class="RubyConvertAllHashesInFileInspections" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
8
+ <inspection_tool class="RubyStringKeysInHashInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
9
+ <inspection_tool class="SpellCheckingInspection" enabled="true" level="INFORMATION" enabled_by_default="true">
10
+ <option name="processCode" value="true" />
11
+ <option name="processLiterals" value="true" />
12
+ <option name="processComments" value="true" />
13
+ </inspection_tool>
14
+ </profile>
15
+ </component>
data/.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="rbenv: 2.7.2" project-jdk-type="RUBY_SDK" />
4
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/good_luck_charm.iml" filepath="$PROJECT_DIR$/.idea/good_luck_charm.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,39 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.1
3
+
4
+ Metrics/AbcSize:
5
+ Max: 170
6
+
7
+ Metrics/BlockLength:
8
+ Max: 250
9
+
10
+ Metrics/ClassLength:
11
+ Max: 1000
12
+
13
+ Metrics/CyclomaticComplexity:
14
+ Max: 70
15
+
16
+ Metrics/MethodLength:
17
+ Max: 100
18
+
19
+ Metrics/ModuleLength:
20
+ Max: 1000
21
+
22
+ Metrics/PerceivedComplexity:
23
+ Max: 80
24
+
25
+ Layout/SpaceInsideBlockBraces:
26
+ EnforcedStyle: no_space
27
+ SpaceBeforeBlockParameters: false
28
+
29
+ Style/Documentation:
30
+ Enabled: false
31
+
32
+ Style/NumericPredicate:
33
+ EnforcedStyle: comparison
34
+
35
+ Style/MultilineBlockChain:
36
+ Enabled: false
37
+
38
+ Style/SpecialGlobalVars:
39
+ EnforcedStyle: use_perl_names
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in good_luck_charm.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,59 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ good_luck_charm (0.1.1)
5
+ rounding
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ diff-lcs (1.5.0)
12
+ parallel (1.22.1)
13
+ parser (3.1.2.0)
14
+ ast (~> 2.4.1)
15
+ rainbow (3.1.1)
16
+ rake (13.0.6)
17
+ regexp_parser (2.5.0)
18
+ rexml (3.2.5)
19
+ rounding (1.0.1)
20
+ rspec (3.11.0)
21
+ rspec-core (~> 3.11.0)
22
+ rspec-expectations (~> 3.11.0)
23
+ rspec-mocks (~> 3.11.0)
24
+ rspec-core (3.11.0)
25
+ rspec-support (~> 3.11.0)
26
+ rspec-expectations (3.11.0)
27
+ diff-lcs (>= 1.2.0, < 2.0)
28
+ rspec-support (~> 3.11.0)
29
+ rspec-mocks (3.11.1)
30
+ diff-lcs (>= 1.2.0, < 2.0)
31
+ rspec-support (~> 3.11.0)
32
+ rspec-support (3.11.0)
33
+ rubocop (1.30.1)
34
+ parallel (~> 1.10)
35
+ parser (>= 3.1.0.0)
36
+ rainbow (>= 2.2.2, < 4.0)
37
+ regexp_parser (>= 1.8, < 3.0)
38
+ rexml (>= 3.2.5, < 4.0)
39
+ rubocop-ast (>= 1.18.0, < 2.0)
40
+ ruby-progressbar (~> 1.7)
41
+ unicode-display_width (>= 1.4.0, < 3.0)
42
+ rubocop-ast (1.18.0)
43
+ parser (>= 3.1.1.0)
44
+ ruby-progressbar (1.11.0)
45
+ timecop (0.9.5)
46
+ unicode-display_width (2.1.0)
47
+
48
+ PLATFORMS
49
+ arm64-darwin-21
50
+
51
+ DEPENDENCIES
52
+ good_luck_charm!
53
+ rake
54
+ rspec
55
+ rubocop
56
+ timecop
57
+
58
+ BUNDLED WITH
59
+ 2.3.15
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # GoodLuckCharm
2
+
3
+ 飛んでけ! 全力パワーで投げたメロディーに乗せて
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ $ bundle add good_luck_charm
10
+
11
+ If bundler is not being used to manage dependencies, install the gem by executing:
12
+
13
+ $ gem install good_luck_charm
14
+
15
+ ## Usage
16
+
17
+ ```rb
18
+ loop do
19
+ (@charm ||= GoodLuckCharm.new).tondeke!
20
+ if @charm.changed_per?(60)
21
+ puts 'kana' # this statement is called only once in a minute)
22
+ end
23
+ sleep 1
24
+ end
25
+ ````
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ 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`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Ishotihadus/good_luck_charm.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/good_luck_charm/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'good_luck_charm'
7
+ spec.version = GoodLuckCharm::VERSION
8
+ spec.authors = ['Ishotihadus']
9
+ spec.email = ['hanachan.pao@gmail.com']
10
+
11
+ spec.summary = 'おまじない'
12
+ spec.description = 'おまじない'
13
+ spec.homepage = 'https://github.com/Ishotihadus/good_luck_charm'
14
+ spec.required_ruby_version = '>= 3.1.0'
15
+
16
+ spec.metadata['homepage_uri'] = spec.homepage
17
+ spec.metadata['source_code_uri'] = 'https://github.com/Ishotihadus/good_luck_charm'
18
+
19
+ spec.files = Dir.chdir(__dir__) do
20
+ `git ls-files -z`.split("\x0").reject do |f|
21
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
22
+ end
23
+ end
24
+ spec.bindir = 'exe'
25
+ spec.executables = spec.files.grep(%r{\Aexe/}) {|f| File.basename(f)}
26
+ spec.require_paths = ['lib']
27
+
28
+ spec.add_dependency 'rounding'
29
+ spec.add_development_dependency 'rake'
30
+ spec.add_development_dependency 'rspec'
31
+ spec.add_development_dependency 'rubocop'
32
+ spec.add_development_dependency 'timecop'
33
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rounding'
4
+
5
+ # This utility can be used by writing a good luck charm.
6
+ # ```rb
7
+ # loop do
8
+ # (@charm ||= GoodLuckCharm.new).tondeke!
9
+ # if @charm.changed_per?(60)
10
+ # puts 'kana' # this statement is called only once in a minute)
11
+ # end
12
+ # sleep 1
13
+ # end
14
+ # ````
15
+ class GoodLuckCharm
16
+ # 飛んでけ!
17
+ def tondeke!
18
+ @last_time = @current_time
19
+ @current_time = Time.now
20
+ self
21
+ end
22
+
23
+ # returns true once a specified period
24
+ # @param [Numeric] seconds 周期
25
+ # @param [Boolean] init returned value at first run
26
+ def changed_per?(seconds, init: false)
27
+ return init unless @last_time && Time.now
28
+
29
+ @last_time.ceil_to(seconds) <= Time.now
30
+ end
31
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class GoodLuckCharm
4
+ VERSION = '0.1.1'
5
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'good_luck_charm/good_luck_charm'
4
+ require_relative 'good_luck_charm/version'
@@ -0,0 +1,9 @@
1
+ class GoodLuckCharm
2
+ VERSION: String
3
+
4
+ @current_time: Time?
5
+ @last_time: Time?
6
+
7
+ def tondeke!: -> self
8
+ def changed_per?: (Numeric seconds, ?init: bool) -> bool
9
+ end
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: good_luck_charm
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Ishotihadus
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-06-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rounding
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
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: 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: rubocop
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: おまじない
84
+ email:
85
+ - hanachan.pao@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".idea/.gitignore"
91
+ - ".idea/good_luck_charm.iml"
92
+ - ".idea/inspectionProfiles/Project_Default.xml"
93
+ - ".idea/misc.xml"
94
+ - ".idea/modules.xml"
95
+ - ".idea/vcs.xml"
96
+ - ".rspec"
97
+ - ".rubocop.yml"
98
+ - Gemfile
99
+ - Gemfile.lock
100
+ - README.md
101
+ - Rakefile
102
+ - good_luck_charm.gemspec
103
+ - lib/good_luck_charm.rb
104
+ - lib/good_luck_charm/good_luck_charm.rb
105
+ - lib/good_luck_charm/version.rb
106
+ - sig/good_luck_charm.rbs
107
+ homepage: https://github.com/Ishotihadus/good_luck_charm
108
+ licenses: []
109
+ metadata:
110
+ homepage_uri: https://github.com/Ishotihadus/good_luck_charm
111
+ source_code_uri: https://github.com/Ishotihadus/good_luck_charm
112
+ post_install_message:
113
+ rdoc_options: []
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: 3.1.0
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ requirements: []
127
+ rubygems_version: 3.3.3
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: おまじない
131
+ test_files: []