okatte 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9d0c72686edfc7fdb1e08178368da654f460ce68
4
+ data.tar.gz: e55ffc8e015a517256af9042f639e7d8a21978d6
5
+ SHA512:
6
+ metadata.gz: 97aad17720a66d0b638a298f460bf3bfe6e12215df4ac6e611f92106d1f221142127b66b8e0d6e18b14763295acf34f63a5c407a5a7cc965f32d0ad750b8d220
7
+ data.tar.gz: 3622dad2bb38f118f056aca69478770c2a920ec4339da78688dc028b740cc3d22c4aa4f66116cea01bb53443f4ba76b0c6ee249ed9b364ec77a0e1a6710a79e5
@@ -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 rina.m.takase@gmail.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,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in okatte.gemspec
4
+ gemspec
@@ -0,0 +1,35 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ okatte (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.3)
10
+ rake (10.5.0)
11
+ rspec (3.6.0)
12
+ rspec-core (~> 3.6.0)
13
+ rspec-expectations (~> 3.6.0)
14
+ rspec-mocks (~> 3.6.0)
15
+ rspec-core (3.6.0)
16
+ rspec-support (~> 3.6.0)
17
+ rspec-expectations (3.6.0)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.6.0)
20
+ rspec-mocks (3.6.0)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (~> 3.6.0)
23
+ rspec-support (3.6.0)
24
+
25
+ PLATFORMS
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ bundler (~> 1.14)
30
+ okatte!
31
+ rake (~> 10.0)
32
+ rspec (~> 3.0)
33
+
34
+ BUNDLED WITH
35
+ 1.14.6
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 tako
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,27 @@
1
+ # Okatte
2
+ Build emoji recipe
3
+
4
+ ## Installation
5
+
6
+ Add this line to your application's Gemfile:
7
+
8
+ ```ruby
9
+ gem 'okatte'
10
+ ```
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install okatte
19
+
20
+ ## Usage
21
+
22
+ coming soon..
23
+
24
+ ## License
25
+
26
+ under [MIT License](http://opensource.org/licenses/MIT).
27
+
@@ -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,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "okatte"
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(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,39 @@
1
+ class Action
2
+ class << self
3
+ def cut(amount:, ingredient:)
4
+ raise ArgumentError, "#{ingredient.class.name} is not cuttable" unless ingredient.cuttable?
5
+ step = "🔪 #{ingredient.title}"
6
+ # loop do
7
+ # step += '🔪'
8
+ # ingredient.condition += 1
9
+ # break if finish_condition?(ingredient.condition, amount)
10
+ # end
11
+ puts step
12
+ end
13
+
14
+ def mix(kitchenware:, ingredients: [])
15
+ raise ArgumentError, "#{kitchenware.class.name} can't mix" unless kitchenware.actions.include?(:mix)
16
+ step = "🌀 #{kitchenware.title} #{ingredients.map(&:title).join}"
17
+ puts step
18
+ end
19
+
20
+ def pickle(kitchenware:, ingredients: [])
21
+ raise ArgumentError, "#{kitchenware.class.name} can't pickle" unless kitchenware.actions.include?(:pickle)
22
+ step = "(pickle) #{kitchenware.title} #{ingredients.map(&:title).join}"
23
+ puts step
24
+ end
25
+
26
+ def toast(kitchenware: nil, ingredients: [])
27
+ raise ArgumentError, "#{kitchenware.class.name} can't toast" if kitchenware && !kitchenware.actions.include?(:toast)
28
+ step = "🍳🔥 #{ingredients.map(&:title).join}"
29
+ puts step
30
+ end
31
+
32
+ private
33
+
34
+ def finish_condition?(condition, arg)
35
+ condition >= arg
36
+ end
37
+ end
38
+ end
39
+
@@ -0,0 +1,26 @@
1
+ require "okatte/version"
2
+
3
+ class Cooking
4
+ def initialize(title:, ingredients:, kitchenware:)
5
+ @title = title
6
+ @ingredients = ingredients
7
+ @kitchenware = kitchenware
8
+ end
9
+
10
+ def start!
11
+ puts @title
12
+ puts "\n===== preparation ===== \n\ningredient:"
13
+ text = ''
14
+ @ingredients.each do |k ,v|
15
+ text += "#{k.title * v} "
16
+ end
17
+ puts text
18
+ puts "\nkitchenware:"
19
+ text = ''
20
+ @kitchenware.each do |k, _|
21
+ text += "#{k.title} "
22
+ end
23
+ puts text
24
+ puts "\n ===== cooking start! ===== \n\n"
25
+ end
26
+ end
@@ -0,0 +1,92 @@
1
+ class Ingredient
2
+ def cuttable?
3
+ false
4
+ end
5
+
6
+ def raw_eatable?
7
+ false
8
+ end
9
+ end
10
+
11
+ class PlainBread < Ingredient
12
+ attr_accessor :slice, :title, :condition
13
+ def initialize(slice:)
14
+ @slice = slice
15
+ @condition = 0
16
+ @title = '🍞'
17
+ end
18
+
19
+ def cuttable?
20
+ true
21
+ end
22
+
23
+ def raw_eatable?
24
+ true
25
+ end
26
+ end
27
+
28
+ class Egg < Ingredient
29
+ attr_accessor :size, :condition, :title
30
+ def initialize
31
+ @condition = 0
32
+ @title = '🐣'
33
+ end
34
+
35
+ def raw_eatable?
36
+ true
37
+ end
38
+ end
39
+
40
+ class Potato < Ingredient
41
+ attr_accessor :size, :condition, :title
42
+ def initialize(size:)
43
+ @size = size
44
+ @condition = 0
45
+ @title = '(potato)'
46
+ end
47
+
48
+ def cuttable?
49
+ true
50
+ end
51
+
52
+ def raw_eatable?
53
+ true
54
+ end
55
+ end
56
+
57
+ class Sugar < Ingredient
58
+ attr_accessor :condition, :title
59
+ def initialize
60
+ @condition = 0
61
+ @title = '(sugar)'
62
+ end
63
+
64
+ def raw_eatable?
65
+ true
66
+ end
67
+ end
68
+
69
+ class Milk < Ingredient
70
+ attr_accessor :condition, :title
71
+ def initialize
72
+ @condition = 0
73
+ @title = '(milk)'
74
+ end
75
+
76
+ def raw_eatable?
77
+ true
78
+ end
79
+ end
80
+
81
+ class Chicken < Ingredient
82
+ attr_accessor :condition, :title
83
+ def initialize(part:)
84
+ @part = part
85
+ @condition = 0
86
+ @title = '🐔#{part}'
87
+ end
88
+
89
+ def cuttable?
90
+ true
91
+ end
92
+ end
@@ -0,0 +1,9 @@
1
+ class Bowl
2
+ attr_reader :actions, :title
3
+
4
+ def initialize(size:)
5
+ @actions = [:mix, :pickle]
6
+ @size = size
7
+ @title = '(bowl)'
8
+ end
9
+ end
@@ -0,0 +1 @@
1
+ Dir[File.join(File.expand_path(File.dirname(__FILE__)), '**/*.rb')].each { |f| require f }
@@ -0,0 +1,3 @@
1
+ module Okatte
2
+ VERSION = "0.1.0"
3
+ end
@@ -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 'okatte/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "okatte"
8
+ spec.version = Okatte::VERSION
9
+ spec.authors = ["tako"]
10
+ spec.email = ["rina.m.takase@gmail.com"]
11
+
12
+ spec.summary = %q{cook with ruby}
13
+ spec.description = %q{cook with ruby}
14
+ spec.homepage = "https://github.com/takose/okatte"
15
+ spec.license = "MIT"
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.14"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rspec", "~> 3.0"
26
+ end
@@ -0,0 +1,28 @@
1
+ require 'okatte'
2
+
3
+ # potato = Potato.new(size: 'middle')
4
+ # Action.cut(ingredient: potato, amount: 3)
5
+
6
+ cooking = Cooking.new(
7
+ title: 'French toast',
8
+ ingredients: {
9
+ plain_bread = PlainBread.new(slice: 8) => 1,
10
+ egg = Egg.new => 2,
11
+ milk = Milk.new => 1,
12
+ sugar = Sugar.new => 1
13
+ },
14
+ kitchenware: [
15
+ bowl = Bowl.new(size: 'middle')
16
+ ]
17
+ )
18
+
19
+ cooking.start!
20
+
21
+ print '1.'
22
+ Action.cut(ingredient: plain_bread, amount: 4)
23
+ print '2.'
24
+ Action.mix(kitchenware: bowl, ingredients: [egg, milk, sugar])
25
+ print '3.'
26
+ Action.pickle(kitchenware: bowl, ingredients: [plain_bread])
27
+ print '4.'
28
+ Action.toast(ingredients: [plain_bread])
@@ -0,0 +1,32 @@
1
+ French toast
2
+
3
+ ===== preparation =====
4
+
5
+ ingredient:
6
+ 🍞 🐣🐣 (milk) (sugar)
7
+
8
+ kitchenware:
9
+ (bowl)
10
+
11
+ ===== cooking start! =====
12
+
13
+ 1.🔪 🍞
14
+ 2.🌀 (bowl) 🐣(milk)(sugar)
15
+ 3.(pickle) (bowl) 🍞
16
+ 4.🍳🔥 🍞
17
+ French toast
18
+
19
+ ===== preparation =====
20
+
21
+ ingredient:
22
+ 🍞 🐣🐣 (milk) (sugar)
23
+
24
+ kitchenware:
25
+ (bowl)
26
+
27
+ ===== cooking start! =====
28
+
29
+ 1.🔪 🍞
30
+ 2.🌀 (bowl) 🐣(milk)(sugar)
31
+ 3.(pickle) (bowl) 🍞
32
+ 4.🍳🔥 🍞
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: okatte
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - tako
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-05-08 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.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.14'
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: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: cook with ruby
56
+ email:
57
+ - rina.m.takase@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - CODE_OF_CONDUCT.md
63
+ - Gemfile
64
+ - Gemfile.lock
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - lib/actions.rb
71
+ - lib/cooking.rb
72
+ - lib/ingredients.rb
73
+ - lib/kitchenwares.rb
74
+ - lib/okatte.rb
75
+ - lib/okatte/version.rb
76
+ - okatte.gemspec
77
+ - sample/app.rb
78
+ - sample/output.txt
79
+ homepage: https://github.com/takose/okatte
80
+ licenses:
81
+ - MIT
82
+ metadata: {}
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.6.12
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: cook with ruby
103
+ test_files: []