neko_gem 0.1.0

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: '01531718ee1999ea6648d442f84691272ea882363a96e5de74b8ce39ea1fbd56'
4
+ data.tar.gz: 84b795fe60d609768d938d945c650e6f6b446dff00322f1365dfd0c59e8e8a87
5
+ SHA512:
6
+ metadata.gz: ecde5d43688b6fef77ded2edf9d426424612aad87130d45afd5c554dd956640756dbf4cf88fb367ab34a1eb310bf348eac3d7cfed308da9642f385b09320c825
7
+ data.tar.gz: 4e632413ac6c7500237f6ac955496158db423d0f051246c02d9b9e21161da3b6ab2c34d15878f9d7359ddb9f2a5fefd7a2a6239d0ed8d0296adca407959e06fb
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.1
3
+
4
+ Style/StringLiterals:
5
+ EnforcedStyle: double_quotes
6
+
7
+ Style/StringLiteralsInInterpolation:
8
+ EnforcedStyle: double_quotes
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2025-10-10
4
+
5
+ - Initial release
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 sugawara_nagisa
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,111 @@
1
+ # NekoGem
2
+
3
+ 猫のアスキーアートとカレンダー機能を提供するRuby gemです。
4
+
5
+ ## 機能
6
+
7
+ - 🐱 猫のアスキーアート表示
8
+ - 📅 カレンダー生成機能
9
+ - 🎲 ランダムな猫のアスキーアート
10
+ - 💻 コマンドライン実行可能
11
+
12
+ ## インストール
13
+
14
+ ```bash
15
+ gem install neko_gem
16
+ ```
17
+
18
+ または、Gemfileに追加:
19
+
20
+ ```ruby
21
+ gem 'neko_gem'
22
+ ```
23
+
24
+ ## 使用方法
25
+
26
+ ### コマンドラインから
27
+
28
+ ```bash
29
+ # デフォルトの猫を表示
30
+ neko
31
+
32
+ # ランダムな猫を表示
33
+ neko --random
34
+ # または
35
+ neko -r
36
+
37
+ # ヘルプを表示
38
+ neko --help
39
+ ```
40
+
41
+ ### Rubyコードから
42
+
43
+ ```ruby
44
+ require 'neko_gem'
45
+
46
+ # 猫のアスキーアートを表示
47
+ NekoGem.show_cat
48
+
49
+ # ランダムな猫のアスキーアートを表示
50
+ NekoGem::AsciiArt.display_random_cat
51
+
52
+ # カレンダーを生成
53
+ calendar = NekoGem.generate_calendar(2024, 1)
54
+ puts calendar[:year] # => 2024
55
+ puts calendar[:month] # => 1
56
+ puts calendar[:weekdays] # => ["日", "月", "火", "水", "木", "金", "土"]
57
+ ```
58
+
59
+ ### Railsアプリケーションで
60
+
61
+ ```ruby
62
+ # コントローラーで
63
+ def index
64
+ @cat_art = NekoGem.show_cat
65
+ @calendar = NekoGem.generate_calendar(2024, 1)
66
+ end
67
+ ```
68
+
69
+ ```erb
70
+ <!-- ビューで -->
71
+ <pre><%= @cat_art %></pre>
72
+
73
+ <div class="calendar">
74
+ <h2><%= @calendar[:year] %>年<%= @calendar[:month] %>月</h2>
75
+ <!-- カレンダー表示のロジック -->
76
+ </div>
77
+ ```
78
+
79
+ ## 開発
80
+
81
+ リポジトリをクローンした後、依存関係をインストール:
82
+
83
+ ```bash
84
+ bundle install
85
+ ```
86
+
87
+ テストを実行:
88
+
89
+ ```bash
90
+ bundle exec rspec
91
+ ```
92
+
93
+ 対話的なプロンプトで実験:
94
+
95
+ ```bash
96
+ bin/console
97
+ ```
98
+
99
+ gemをローカルにインストール:
100
+
101
+ ```bash
102
+ bundle exec rake install
103
+ ```
104
+
105
+ ## 貢献
106
+
107
+ バグレポートやプルリクエストは、GitHubの https://github.com/sugawara_nagisa/neko_gem で歓迎します。
108
+
109
+ ## ライセンス
110
+
111
+ このgemは[MIT License](https://opensource.org/licenses/MIT)の下でオープンソースとして利用可能です。
data/Rakefile ADDED
@@ -0,0 +1,12 @@
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
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/neko ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "neko_gem"
6
+
7
+ # コマンドライン引数をチェック
8
+ if ARGV.include?("--random") || ARGV.include?("-r")
9
+ NekoGem::AsciiArt.display_random_cat
10
+ elsif ARGV.include?("--help") || ARGV.include?("-h")
11
+ puts <<~HELP
12
+ neko_gem - 猫のアスキーアートを表示するgem
13
+
14
+ 使用方法:
15
+ neko # デフォルトの猫を表示
16
+ neko --random, -r # ランダムな猫を表示
17
+ neko --help, -h # このヘルプを表示
18
+
19
+ 例:
20
+ neko
21
+ neko -r
22
+ HELP
23
+ else
24
+ NekoGem::AsciiArt.display_cat
25
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NekoGem
4
+ class AsciiArt
5
+ # 猫のアスキーアートを返す
6
+ def self.cat
7
+ <<~CAT
8
+ /\\_/\\
9
+ ( o.o )
10
+ > ^ <
11
+
12
+ にゃーん!(^_^)
13
+ CAT
14
+ end
15
+
16
+ # 複数の猫のアスキーアートからランダムに選択
17
+ def self.random_cat
18
+ cats = [
19
+ <<~CAT1,
20
+ /\\_/\\
21
+ ( o.o )
22
+ > ^ <
23
+
24
+ にゃーん!(^_^)
25
+ CAT1
26
+ <<~CAT2,
27
+ /\\_/\\
28
+ ( -.- )
29
+ > ^ <
30
+
31
+ 眠いにゃん...(-_-)
32
+ CAT2
33
+ <<~CAT3,
34
+ /\\_/\\
35
+ ( ^.^ )
36
+ > ^ <
37
+
38
+ ご機嫌にゃん!(^o^)
39
+ CAT3
40
+ <<~CAT4,
41
+ /\\_/\\
42
+ ( @.@ )
43
+ > ^ <
44
+
45
+ びっくりにゃん!(@_@)
46
+ CAT4
47
+ ]
48
+
49
+ cats.sample
50
+ end
51
+
52
+ # 猫のアスキーアートを表示(putsで出力)
53
+ def self.display_cat
54
+ puts cat
55
+ end
56
+
57
+ # ランダムな猫のアスキーアートを表示
58
+ def self.display_random_cat
59
+ puts random_cat
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "date"
4
+
5
+ module NekoGem
6
+ class Calendar
7
+ def initialize(year, month)
8
+ @year = year
9
+ @month = month
10
+ @date = Date.new(year, month, 1)
11
+ end
12
+
13
+ def generate
14
+ {
15
+ year: @year,
16
+ month: @month,
17
+ days: generate_days,
18
+ weekdays: %w[日 月 火 水 木 金 土]
19
+ }
20
+ end
21
+
22
+ private
23
+
24
+ def generate_days
25
+ days = []
26
+ start_date = Date.new(@year, @month, 1)
27
+ end_date = Date.new(@year, @month, -1)
28
+
29
+ # 前月の空白日を追加
30
+ start_date.wday.times do
31
+ days << nil
32
+ end
33
+
34
+ # 当月の日付を追加
35
+ (start_date..end_date).each do |date|
36
+ days << {
37
+ date: date,
38
+ day: date.day,
39
+ is_today: date == Date.today,
40
+ is_weekend: date.saturday? || date.sunday?
41
+ }
42
+ end
43
+
44
+ days
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NekoGem
4
+ VERSION = "0.1.0"
5
+ end
data/lib/neko_gem.rb ADDED
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "neko_gem/version"
4
+ require_relative "neko_gem/ascii_art"
5
+ require_relative "neko_gem/calendar"
6
+
7
+ module NekoGem
8
+ class Error < StandardError; end
9
+
10
+ # 猫のアスキーアートを表示
11
+ def self.show_cat
12
+ AsciiArt.cat
13
+ end
14
+
15
+ # カレンダーを生成するメソッド
16
+ def self.generate_calendar(year, month)
17
+ Calendar.new(year, month).generate
18
+ end
19
+
20
+ # 今日の日付を取得
21
+ def self.today
22
+ Date.today
23
+ end
24
+ end
data/sig/neko_gem.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module NekoGem
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: neko_gem
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - sugawara_nagisa
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2025-10-09 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: rails
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '6.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '6.0'
26
+ description: Railsアプリケーションでカレンダー機能を簡単に実装できるヘルパーメソッドを提供します
27
+ email:
28
+ - nyuwamochi@gmail.com
29
+ executables:
30
+ - neko
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".rspec"
35
+ - ".rubocop.yml"
36
+ - CHANGELOG.md
37
+ - LICENSE.txt
38
+ - README.md
39
+ - Rakefile
40
+ - bin/neko
41
+ - lib/neko_gem.rb
42
+ - lib/neko_gem/ascii_art.rb
43
+ - lib/neko_gem/calendar.rb
44
+ - lib/neko_gem/version.rb
45
+ - sig/neko_gem.rbs
46
+ homepage: https://github.com/NYUWAMOCHI/neko_gem
47
+ licenses:
48
+ - MIT
49
+ metadata:
50
+ allowed_push_host: https://rubygems.org
51
+ homepage_uri: https://github.com/NYUWAMOCHI/neko_gem
52
+ source_code_uri: https://github.com/NYUWAMOCHI/neko_gem
53
+ changelog_uri: https://github.com/NYUWAMOCHI/neko_gem/blob/main/CHANGELOG.md
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 3.1.0
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubygems_version: 3.6.2
69
+ specification_version: 4
70
+ summary: カレンダー機能を提供するgem
71
+ test_files: []