rubynovice 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/.yardopts +5 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +19 -0
- data/Rakefile +46 -0
- data/doc/Donkey.html +297 -0
- data/doc/Rubynovice.html +466 -0
- data/doc/_index.html +138 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.en.html +104 -0
- data/doc/file.README.html +101 -0
- data/doc/file.README.ja.html +80 -0
- data/doc/file.README_en.html +104 -0
- data/doc/file.README_ja.html +101 -0
- data/doc/file.ex1.html +100 -0
- data/doc/file.ex2.html +147 -0
- data/doc/file.ex3.html +139 -0
- data/doc/file_list.html +75 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +101 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +105 -0
- data/doc/top-level-namespace.html +112 -0
- data/docs/README_en.hiki +35 -0
- data/docs/README_en.md +31 -0
- data/docs/README_ja.hiki +19 -0
- data/docs/README_ja.md +19 -0
- data/docs/ex1.hiki +26 -0
- data/docs/ex1.md +26 -0
- data/docs/ex2.hiki +71 -0
- data/docs/ex2.md +71 -0
- data/docs/ex3.hiki +61 -0
- data/docs/ex3.md +61 -0
- data/exe/rubynovice +3 -0
- data/lib/rubynovice.rb +27 -0
- data/lib/rubynovice/donkey.rb +17 -0
- data/lib/rubynovice/version.rb +3 -0
- data/rubynovice.gemspec +36 -0
- metadata +163 -0
data/docs/ex2.md
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# Ex2. Loop
|
2
|
+
|
3
|
+
## Ex2_2:times
|
4
|
+
|
5
|
+
百回愛してると表示する.
|
6
|
+
```
|
7
|
+
100.times do
|
8
|
+
puts "I love Haruyo."
|
9
|
+
end
|
10
|
+
```
|
11
|
+
## Ex2_3:for-loop
|
12
|
+
```tcsh
|
13
|
+
1
|
14
|
+
2
|
15
|
+
3
|
16
|
+
4
|
17
|
+
5
|
18
|
+
```
|
19
|
+
|
20
|
+
```tcsh
|
21
|
+
for i in 1..5 do
|
22
|
+
puts i
|
23
|
+
end
|
24
|
+
```
|
25
|
+
|
26
|
+
## Ex2_4:while
|
27
|
+
```
|
28
|
+
while 条件文 do
|
29
|
+
繰り返し
|
30
|
+
end
|
31
|
+
```
|
32
|
+
```
|
33
|
+
10
|
34
|
+
8
|
35
|
+
6
|
36
|
+
4
|
37
|
+
2
|
38
|
+
```
|
39
|
+
|
40
|
+
## Ex2_5:二重ループ(printを使って..)(doubleLoop)
|
41
|
+
```
|
42
|
+
1,1
|
43
|
+
1,2
|
44
|
+
1,3
|
45
|
+
2,1
|
46
|
+
2,2
|
47
|
+
2,3
|
48
|
+
3,1
|
49
|
+
3,2
|
50
|
+
3,3
|
51
|
+
```
|
52
|
+
## Ex2_6:九九表(printfを使って)(9x9)
|
53
|
+
```
|
54
|
+
1 2 3 4 5 6 7 8 9
|
55
|
+
2 4 6 8 10 12 14 16 18
|
56
|
+
3 6 9 12 15 18 21 24 27
|
57
|
+
4 8 12 16 20 24 28 32 36
|
58
|
+
5 10 15 20 25 30 35 40 45
|
59
|
+
6 12 18 24 30 36 42 48 54
|
60
|
+
7 14 21 28 35 42 49 56 63
|
61
|
+
8 16 24 32 40 48 56 64 72
|
62
|
+
9 18 27 36 45 54 63 72 81
|
63
|
+
```
|
64
|
+
## Ex2_6:1から10までの和(sum)
|
65
|
+
```
|
66
|
+
55
|
67
|
+
```
|
68
|
+
## Ex2_7:10!(10*9*8..3*2*1) (factorial)
|
69
|
+
```
|
70
|
+
3628800
|
71
|
+
```
|
data/docs/ex3.hiki
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
!Ex3. 配列
|
2
|
+
!!Ex3_1:配列(list)
|
3
|
+
<<< tcsh
|
4
|
+
5
|
5
|
+
4
|
6
|
+
3
|
7
|
+
2
|
8
|
+
1
|
9
|
+
>>>
|
10
|
+
<<< ruby
|
11
|
+
a=[5,4,3,2,1]
|
12
|
+
for i in 0..4 do
|
13
|
+
puts a[i]
|
14
|
+
end
|
15
|
+
>>>
|
16
|
+
<<< ruby
|
17
|
+
a=[5,4,3,2,1]
|
18
|
+
a.each do |tmp|
|
19
|
+
puts tmp
|
20
|
+
end
|
21
|
+
>>>
|
22
|
+
!!Ex3_2:1から100までの乱数を10個格納した配列を作れ.(rand)
|
23
|
+
<<< tcsh
|
24
|
+
[9, 13, 5, 51, 15, 51, 5, 99, 77, 88]
|
25
|
+
>>>
|
26
|
+
<<< ruby
|
27
|
+
a=[]
|
28
|
+
10.times do
|
29
|
+
tmp=rand(100)+1
|
30
|
+
puts tmp
|
31
|
+
a << tmp
|
32
|
+
end
|
33
|
+
p a
|
34
|
+
>>>
|
35
|
+
!!Ex3_3:さいころを100回振って,1から6の目が何回出たかを表示せよ(dice)
|
36
|
+
<<< tcsh
|
37
|
+
[0, 21, 15, 17, 15, 13, 19]
|
38
|
+
>>>
|
39
|
+
!!Ex3_4:rand()で生成される小数の10桁目までを配列に蓄えよ.(rand2list)
|
40
|
+
<<< tcsh
|
41
|
+
0.975006684566814
|
42
|
+
[9, 7, 5, 0, 0, 6, 6, 8, 4, 5]
|
43
|
+
>>>
|
44
|
+
<<< ruby
|
45
|
+
a=rand()
|
46
|
+
puts a
|
47
|
+
num=[]
|
48
|
+
10.times do
|
49
|
+
b=(a*10).to_i
|
50
|
+
puts b
|
51
|
+
a=a*10-b
|
52
|
+
num << b
|
53
|
+
end
|
54
|
+
p num
|
55
|
+
>>>
|
56
|
+
!!Ex3_5前問で求めた配列から10桁の整数を作れ.(list2int)
|
57
|
+
<<< tcsh
|
58
|
+
0.258949661837373
|
59
|
+
[2, 5, 8, 9, 4, 9, 6, 6, 1, 8]
|
60
|
+
2589496618
|
61
|
+
>>>
|
data/docs/ex3.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Ex3. 配列
|
2
|
+
## Ex3_1:配列(list)
|
3
|
+
```tcsh
|
4
|
+
5
|
5
|
+
4
|
6
|
+
3
|
7
|
+
2
|
8
|
+
1
|
9
|
+
```
|
10
|
+
```ruby
|
11
|
+
a=[5,4,3,2,1]
|
12
|
+
for i in 0..4 do
|
13
|
+
puts a[i]
|
14
|
+
end
|
15
|
+
```
|
16
|
+
```ruby
|
17
|
+
a=[5,4,3,2,1]
|
18
|
+
a.each do |tmp|
|
19
|
+
puts tmp
|
20
|
+
end
|
21
|
+
```
|
22
|
+
## Ex3_2:1から100までの乱数を10個格納した配列を作れ.(rand)
|
23
|
+
```tcsh
|
24
|
+
[9, 13, 5, 51, 15, 51, 5, 99, 77, 88]
|
25
|
+
```
|
26
|
+
```ruby
|
27
|
+
a=[]
|
28
|
+
10.times do
|
29
|
+
tmp=rand(100)+1
|
30
|
+
puts tmp
|
31
|
+
a << tmp
|
32
|
+
end
|
33
|
+
p a
|
34
|
+
```
|
35
|
+
## Ex3_3:さいころを100回振って,1から6の目が何回出たかを表示せよ(dice)
|
36
|
+
```tcsh
|
37
|
+
[0, 21, 15, 17, 15, 13, 19]
|
38
|
+
```
|
39
|
+
## Ex3_4:rand()で生成される小数の10桁目までを配列に蓄えよ.(rand2list)
|
40
|
+
```tcsh
|
41
|
+
0.975006684566814
|
42
|
+
[9, 7, 5, 0, 0, 6, 6, 8, 4, 5]
|
43
|
+
```
|
44
|
+
```ruby
|
45
|
+
a=rand()
|
46
|
+
puts a
|
47
|
+
num=[]
|
48
|
+
10.times do
|
49
|
+
b=(a*10).to_i
|
50
|
+
puts b
|
51
|
+
a=a*10-b
|
52
|
+
num << b
|
53
|
+
end
|
54
|
+
p num
|
55
|
+
```
|
56
|
+
## Ex3_5前問で求めた配列から10桁の整数を作れ.(list2int)
|
57
|
+
```tcsh
|
58
|
+
0.258949661837373
|
59
|
+
[2, 5, 8, 9, 4, 9, 6, 6, 1, 8]
|
60
|
+
2589496618
|
61
|
+
```
|
data/exe/rubynovice
ADDED
data/lib/rubynovice.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require "rubynovice/version"
|
2
|
+
require "rubynovice/donkey"
|
3
|
+
|
4
|
+
class Rubynovice
|
5
|
+
attr_accessor :classes
|
6
|
+
# Your code goes here...
|
7
|
+
def initialize
|
8
|
+
name = 'donkey'
|
9
|
+
case name
|
10
|
+
when 'donkey'
|
11
|
+
@classes = Donkey.new
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def ex1_1
|
16
|
+
return @classes.ex1_1
|
17
|
+
end
|
18
|
+
|
19
|
+
def ex1_2
|
20
|
+
return @classes.ex1_2
|
21
|
+
end
|
22
|
+
|
23
|
+
def ex1_3
|
24
|
+
return @classes.ex1_3
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/rubynovice.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rubynovice/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rubynovice"
|
8
|
+
spec.version = Rubynovice::VERSION
|
9
|
+
spec.authors = ["Shigeto R. Nishitani"]
|
10
|
+
spec.email = ["shigeto_nishitani@me.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Ruby programming mastering platform using Github.}
|
13
|
+
spec.description = %q{Ruby programming mastering platform using Github.}
|
14
|
+
spec.homepage = "https://github.com/daddygongon/rubynovice"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
# if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
# else
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
# end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
33
|
+
spec.add_development_dependency "yard", "~> 0.8"
|
34
|
+
spec.add_development_dependency "hiki2md"
|
35
|
+
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubynovice
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shigeto R. Nishitani
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-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.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
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
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: yard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.8'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.8'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: hiki2md
|
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: Ruby programming mastering platform using Github.
|
84
|
+
email:
|
85
|
+
- shigeto_nishitani@me.com
|
86
|
+
executables:
|
87
|
+
- rubynovice
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rspec"
|
93
|
+
- ".travis.yml"
|
94
|
+
- ".yardopts"
|
95
|
+
- CODE_OF_CONDUCT.md
|
96
|
+
- Gemfile
|
97
|
+
- LICENSE.txt
|
98
|
+
- README.md
|
99
|
+
- Rakefile
|
100
|
+
- doc/Donkey.html
|
101
|
+
- doc/Rubynovice.html
|
102
|
+
- doc/_index.html
|
103
|
+
- doc/class_list.html
|
104
|
+
- doc/css/common.css
|
105
|
+
- doc/css/full_list.css
|
106
|
+
- doc/css/style.css
|
107
|
+
- doc/file.README.en.html
|
108
|
+
- doc/file.README.html
|
109
|
+
- doc/file.README.ja.html
|
110
|
+
- doc/file.README_en.html
|
111
|
+
- doc/file.README_ja.html
|
112
|
+
- doc/file.ex1.html
|
113
|
+
- doc/file.ex2.html
|
114
|
+
- doc/file.ex3.html
|
115
|
+
- doc/file_list.html
|
116
|
+
- doc/frames.html
|
117
|
+
- doc/index.html
|
118
|
+
- doc/js/app.js
|
119
|
+
- doc/js/full_list.js
|
120
|
+
- doc/js/jquery.js
|
121
|
+
- doc/method_list.html
|
122
|
+
- doc/top-level-namespace.html
|
123
|
+
- docs/README_en.hiki
|
124
|
+
- docs/README_en.md
|
125
|
+
- docs/README_ja.hiki
|
126
|
+
- docs/README_ja.md
|
127
|
+
- docs/ex1.hiki
|
128
|
+
- docs/ex1.md
|
129
|
+
- docs/ex2.hiki
|
130
|
+
- docs/ex2.md
|
131
|
+
- docs/ex3.hiki
|
132
|
+
- docs/ex3.md
|
133
|
+
- exe/rubynovice
|
134
|
+
- lib/rubynovice.rb
|
135
|
+
- lib/rubynovice/donkey.rb
|
136
|
+
- lib/rubynovice/version.rb
|
137
|
+
- rubynovice.gemspec
|
138
|
+
homepage: https://github.com/daddygongon/rubynovice
|
139
|
+
licenses:
|
140
|
+
- MIT
|
141
|
+
metadata: {}
|
142
|
+
post_install_message:
|
143
|
+
rdoc_options: []
|
144
|
+
require_paths:
|
145
|
+
- lib
|
146
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
requirements: []
|
157
|
+
rubyforge_project:
|
158
|
+
rubygems_version: 2.5.1
|
159
|
+
signing_key:
|
160
|
+
specification_version: 4
|
161
|
+
summary: Ruby programming mastering platform using Github.
|
162
|
+
test_files: []
|
163
|
+
has_rdoc:
|