soniji 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/soniji.rb +57 -0
  2. metadata +46 -0
data/lib/soniji.rb ADDED
@@ -0,0 +1,57 @@
1
+ class Human
2
+ attr_reader :name
3
+ attr_accessor :friendship
4
+ attr_reader :childs
5
+ def initialize(name)
6
+ @name = name
7
+ @friendship = 0
8
+ @childs = []
9
+ end
10
+
11
+ POSSIBLE_NAMES = ['Ralph','LBQ','orzFly','Lynn']
12
+ def has_child
13
+ @childs << Human.new(POSSIBLE_NAMES.sample)
14
+ end
15
+ end
16
+
17
+
18
+ class Soniji < Human
19
+ def has_child
20
+ @childs << Human.new('Sonic1997')
21
+ end
22
+ end
23
+
24
+
25
+ module Kernel
26
+ def say_hi_to person
27
+ puts "You said hi to #{person.name}"
28
+ person.friendship += rand(2)+1
29
+ end
30
+
31
+ def papapa_with person
32
+ puts "You tried to papapa with #{person.name}"
33
+ if person.friendship <= 30
34
+ puts "But he/she refused to do so"
35
+ else
36
+ puts "You successfully papapaed with #{person.name}"
37
+ person.friendship += 10
38
+ person.has_child
39
+ end
40
+ end
41
+
42
+ def murder person
43
+ puts "You successfully murdered #{person.name}"
44
+ person = nil
45
+ end
46
+ end
47
+
48
+
49
+ module Kernel
50
+ def all_humans
51
+ childs = []
52
+ ObjectSpace.each_object Human do |c|
53
+ childs << c
54
+ end
55
+ return childs
56
+ end
57
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: soniji
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - LBQ
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-11-03 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Say hi to soniji!
15
+ email: laoboqi@126.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/soniji.rb
21
+ homepage: http://rubygems.org/gems/soniji
22
+ licenses:
23
+ - MIT
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 1.8.23
43
+ signing_key:
44
+ specification_version: 3
45
+ summary: A Birthday Gift for the orzFlyos!
46
+ test_files: []