sottolio 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +31 -0
- data/LICENSE +676 -0
- data/README.md +26 -0
- data/Rakefile +12 -0
- data/bin/sottolio +29 -0
- data/example/game/include/CanvasText-0.4.js +500 -0
- data/example/game/include/canvasinput.js +379 -0
- data/example/game/include/howler.min.js +10 -0
- data/example/game/include/jquery.min.js +4 -0
- data/example/game/index.html +19 -0
- data/example/game/resources/backgrounds/city.jpg +0 -0
- data/example/game/resources/characters/ambrogia.png +0 -0
- data/example/game/resources/characters/rosalinda.png +0 -0
- data/example/game/resources/right_arrow.png +0 -0
- data/example/game/resources/sounds/Classmate.m4a +0 -0
- data/example/scripts/chapter_1.rb +64 -0
- data/example/scripts/chapter_2.rb +23 -0
- data/example/scripts/script.rb +2 -0
- data/lib/sottolio.rb +19 -0
- data/lib/sottolio/sottolio.rb +22 -0
- data/lib/sottolio/version.rb +21 -0
- data/opal/sottolio.rb +38 -0
- data/opal/sottolio/application.rb +134 -0
- data/opal/sottolio/database.rb +48 -0
- data/opal/sottolio/image_manager.rb +46 -0
- data/opal/sottolio/lock.rb +41 -0
- data/opal/sottolio/script.rb +93 -0
- data/opal/sottolio/sottolio.rb +29 -0
- data/opal/sottolio/sound_manager.rb +55 -0
- data/opal/sottolio/utils.rb +57 -0
- data/opal/sottolio/wrapper/background.rb +21 -0
- data/opal/sottolio/wrapper/canvas.rb +90 -0
- data/opal/sottolio/wrapper/canvas/canvas_button.rb +69 -0
- data/opal/sottolio/wrapper/canvas/canvas_input.rb +73 -0
- data/opal/sottolio/wrapper/canvas/canvas_text.rb +64 -0
- data/opal/sottolio/wrapper/character.rb +21 -0
- data/opal/sottolio/wrapper/image.rb +65 -0
- data/opal/sottolio/wrapper/sound.rb +55 -0
- data/sottolio.gemspec +20 -0
- metadata +114 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
@scripts << Proc.new do
|
2
|
+
background :id => 'city',
|
3
|
+
:resource => 'resources/backgrounds/city.jpg'
|
4
|
+
|
5
|
+
character :id => 'Rosalinda',
|
6
|
+
:resource => 'resources/characters/rosalinda.png',
|
7
|
+
:x => 800,
|
8
|
+
:y => 120
|
9
|
+
|
10
|
+
dialogue :name => 'Rosalinda',
|
11
|
+
:text => 'Hey #name#! Did you enjoy this demo?'
|
12
|
+
|
13
|
+
dialogue :name => 'Rosalinda',
|
14
|
+
:text => 'Discover all myself at https://github.com/RoxasShadow/sottolio!'
|
15
|
+
|
16
|
+
dialogue :name => 'Rosalinda',
|
17
|
+
:text => 'Bye-chee!'
|
18
|
+
|
19
|
+
remove :id => 'Rosalinda',
|
20
|
+
:animation => :slide, # apply a slide animation to the left
|
21
|
+
:to => :left,
|
22
|
+
:speed => 1.7
|
23
|
+
end
|
data/lib/sottolio.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright(C) 2013-2015 Giovanni Capuano <webmaster@giovannicapuano.net>
|
3
|
+
#
|
4
|
+
# This file is part of sottolio.
|
5
|
+
#
|
6
|
+
# sottolio is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# sottolio is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with sottolio. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
require 'sottolio/sottolio'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright(C) 2013-2015 Giovanni Capuano <webmaster@giovannicapuano.net>
|
3
|
+
#
|
4
|
+
# This file is part of sottolio.
|
5
|
+
#
|
6
|
+
# sottolio is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# sottolio is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with sottolio. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
require 'opal'
|
20
|
+
require 'opal/util'
|
21
|
+
|
22
|
+
Opal.append_path File.expand_path('../../../opal', __FILE__)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright(C) 2013-2015 Giovanni Capuano <webmaster@giovannicapuano.net>
|
3
|
+
#
|
4
|
+
# This file is part of sottolio.
|
5
|
+
#
|
6
|
+
# sottolio is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# sottolio is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with sottolio. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
module Sottolio
|
20
|
+
VERSION = '0.1'
|
21
|
+
end
|
data/opal/sottolio.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright(C) 2013-2015 Giovanni Capuano <webmaster@giovannicapuano.net>
|
3
|
+
#
|
4
|
+
# This file is part of sottolio.
|
5
|
+
#
|
6
|
+
# sottolio is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# sottolio is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with sottolio. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
require 'sottolio/sottolio'
|
20
|
+
require 'sottolio/script'
|
21
|
+
require 'sottolio/lock'
|
22
|
+
require 'sottolio/database'
|
23
|
+
require 'sottolio/utils'
|
24
|
+
|
25
|
+
require 'sottolio/wrapper/canvas'
|
26
|
+
require 'sottolio/wrapper/canvas/canvas_input'
|
27
|
+
require 'sottolio/wrapper/canvas/canvas_text'
|
28
|
+
require 'sottolio/wrapper/canvas/canvas_button'
|
29
|
+
|
30
|
+
require 'sottolio/wrapper/image'
|
31
|
+
require 'sottolio/wrapper/background'
|
32
|
+
require 'sottolio/wrapper/character'
|
33
|
+
require 'sottolio/image_manager'
|
34
|
+
|
35
|
+
require 'sottolio/wrapper/sound'
|
36
|
+
require 'sottolio/sound_manager'
|
37
|
+
|
38
|
+
require 'sottolio/application'
|
@@ -0,0 +1,134 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright(C) 2013-2015 Giovanni Capuano <webmaster@giovannicapuano.net>
|
3
|
+
#
|
4
|
+
# This file is part of sottolio.
|
5
|
+
#
|
6
|
+
# sottolio is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# sottolio is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with sottolio. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
include Sottolio
|
20
|
+
|
21
|
+
@scripts = []
|
22
|
+
require 'script'
|
23
|
+
|
24
|
+
if @scripts.empty?
|
25
|
+
puts 'No scripts found.'
|
26
|
+
return
|
27
|
+
end
|
28
|
+
|
29
|
+
canvas_id = Sottolio.get 'game'
|
30
|
+
go_next = Sottolio.get 'next'
|
31
|
+
canvas = Canvas.new canvas_id
|
32
|
+
|
33
|
+
database = Database.new
|
34
|
+
scripts = Script.new @scripts
|
35
|
+
scripts.reverse!
|
36
|
+
|
37
|
+
config = {
|
38
|
+
canvas_id: 'game',
|
39
|
+
font_family: 'Arial',
|
40
|
+
font_size: '30px',
|
41
|
+
font_color: '#000'
|
42
|
+
}
|
43
|
+
lock = Lock.new
|
44
|
+
canvas_text = CanvasText.new canvas_id, config
|
45
|
+
canvas_button = CanvasButton.new canvas_id, config, lock
|
46
|
+
|
47
|
+
sound_manager = SoundManager.new
|
48
|
+
image_manager = ImageManager.new
|
49
|
+
input = nil
|
50
|
+
|
51
|
+
next_dialogue = -> {
|
52
|
+
if lock.free? && (!input || input.destroyed? || (input.present? && !input.empty?)) && scripts.any?
|
53
|
+
input.save_and_destroy if input.is_a?(CanvasInput) && input.present?
|
54
|
+
|
55
|
+
canvas.fill_style = '#fff'
|
56
|
+
|
57
|
+
script = scripts.pop
|
58
|
+
current_command = script.keys.first
|
59
|
+
case current_command
|
60
|
+
when :play_sound
|
61
|
+
return next_dialogue.call unless script[:play_sound].true? database
|
62
|
+
|
63
|
+
sound = Sound.new(script[:play_sound][:resource], script[:play_sound][:loop], script[:play_sound][:volume])
|
64
|
+
sound_manager.add script[:play_sound][:id], sound
|
65
|
+
sound_manager.play script[:play_sound][:id]
|
66
|
+
|
67
|
+
next_dialogue.call
|
68
|
+
when :stop_sound
|
69
|
+
return next_dialogue.call unless script[:stop_sound].true? database
|
70
|
+
|
71
|
+
sound_manager.stop script[:stop_sound][:id]
|
72
|
+
|
73
|
+
next_dialogue.call
|
74
|
+
when :background
|
75
|
+
return next_dialogue.call unless script[:background].true? database
|
76
|
+
|
77
|
+
background = Background.new(canvas_id, script[:background][:resource], script[:background][:id])
|
78
|
+
image_manager.add background
|
79
|
+
image_manager.draw script[:background][:id]
|
80
|
+
|
81
|
+
next_dialogue.call
|
82
|
+
when :character
|
83
|
+
return next_dialogue.call unless script[:character].true? database
|
84
|
+
|
85
|
+
character = Character.new(canvas_id, script[:character][:resource], script[:character][:id])
|
86
|
+
image_manager.add character
|
87
|
+
image_manager.draw script[:character][:id], script[:character][:x], script[:character][:y]
|
88
|
+
|
89
|
+
next_dialogue.call
|
90
|
+
when :remove
|
91
|
+
image_manager.remove script[:remove][:id], script[:remove][:animation], script[:remove][:to], script[:remove][:speed]
|
92
|
+
|
93
|
+
next_dialogue.call
|
94
|
+
when :dialogue
|
95
|
+
return next_dialogue.call unless script[:dialogue].true? database
|
96
|
+
|
97
|
+
canvas.clear
|
98
|
+
|
99
|
+
if script[:dialogue].include? :name
|
100
|
+
canvas_text.write "#{script[:dialogue][:name].apply(database)}: #{script[:dialogue][:text].apply(database)}"
|
101
|
+
else
|
102
|
+
canvas_text.write script[:dialogue][:text].apply(database)
|
103
|
+
end
|
104
|
+
when :input
|
105
|
+
return next_dialogue.call unless script[:input].true? database
|
106
|
+
|
107
|
+
canvas.clear
|
108
|
+
|
109
|
+
if script[:input].include? :name
|
110
|
+
canvas_text.write "#{script[:input][:name].apply(database)}: #{script[:input][:text].apply(database)}"
|
111
|
+
else
|
112
|
+
canvas_text.write script[:input][:text].apply(database)
|
113
|
+
end
|
114
|
+
|
115
|
+
input = CanvasInput.new canvas_id, database, script[:input][:id], script[:input][:request].apply(database)
|
116
|
+
when :choice
|
117
|
+
return next_dialogue.call unless script[:choice].true? database
|
118
|
+
|
119
|
+
canvas.clear
|
120
|
+
|
121
|
+
if script[:choice].include? :name
|
122
|
+
canvas_text.write "#{script[:choice][:name].apply(database)}: #{script[:choice][:text].apply(database)}"
|
123
|
+
else
|
124
|
+
canvas_text.write script[:choice][:text].apply(database)
|
125
|
+
end
|
126
|
+
|
127
|
+
canvas_button.get_choice database, script[:choice][:options], script[:choice][:id], next_dialogue
|
128
|
+
end
|
129
|
+
end
|
130
|
+
}
|
131
|
+
|
132
|
+
next_dialogue.call # bootstrapping
|
133
|
+
|
134
|
+
Sottolio::add_listener :click, go_next, next_dialogue
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright(C) 2013-2015 Giovanni Capuano <webmaster@giovannicapuano.net>
|
3
|
+
#
|
4
|
+
# This file is part of sottolio.
|
5
|
+
#
|
6
|
+
# sottolio is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# sottolio is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with sottolio. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
module Sottolio
|
20
|
+
class Database
|
21
|
+
def initialize
|
22
|
+
@db = {}
|
23
|
+
end
|
24
|
+
|
25
|
+
def add(key, value)
|
26
|
+
@db[key] = value
|
27
|
+
end
|
28
|
+
|
29
|
+
def delete(key)
|
30
|
+
@db.delete key
|
31
|
+
end
|
32
|
+
|
33
|
+
def delete_if(key, &block)
|
34
|
+
@db.delete_if key, &block
|
35
|
+
end
|
36
|
+
|
37
|
+
def get(key)
|
38
|
+
@db[key]
|
39
|
+
end
|
40
|
+
|
41
|
+
def has?(key)
|
42
|
+
@db.include? key
|
43
|
+
end
|
44
|
+
alias_method :exist?, :has?
|
45
|
+
alias_method :exists?, :has?
|
46
|
+
alias_method :include?, :has?
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright(C) 2013-2015 Giovanni Capuano <webmaster@giovannicapuano.net>
|
3
|
+
#
|
4
|
+
# This file is part of sottolio.
|
5
|
+
#
|
6
|
+
# sottolio is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# sottolio is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with sottolio. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
module Sottolio
|
20
|
+
class ImageManager
|
21
|
+
attr_accessor :images
|
22
|
+
|
23
|
+
def initialize
|
24
|
+
@images = {}
|
25
|
+
end
|
26
|
+
|
27
|
+
def add(image)
|
28
|
+
@images[image.id.to_sym] = image
|
29
|
+
end
|
30
|
+
|
31
|
+
def remove(id, animation = :none, to = nil, speed = nil)
|
32
|
+
redraw = -> { @images.each_value &:draw }
|
33
|
+
delete = -> { @images.delete id.to_sym; @images.each_value &:draw }
|
34
|
+
|
35
|
+
if animation == :slide
|
36
|
+
@images[id.to_sym].slide redraw, delete, to, speed
|
37
|
+
else
|
38
|
+
delete.call
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def draw(id, x = nil, y = nil)
|
43
|
+
@images[id.to_sym].draw x, y, x && y
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright(C) 2013-2015 Giovanni Capuano <webmaster@giovannicapuano.net>
|
3
|
+
#
|
4
|
+
# This file is part of sottolio.
|
5
|
+
#
|
6
|
+
# sottolio is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# sottolio is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with sottolio. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
module Sottolio
|
20
|
+
class Lock
|
21
|
+
def initialize
|
22
|
+
free!
|
23
|
+
end
|
24
|
+
|
25
|
+
def locked?
|
26
|
+
@lock == true
|
27
|
+
end
|
28
|
+
|
29
|
+
def free?
|
30
|
+
not locked?
|
31
|
+
end
|
32
|
+
|
33
|
+
def lock!
|
34
|
+
@lock = true
|
35
|
+
end
|
36
|
+
|
37
|
+
def free!
|
38
|
+
@lock = false
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright(C) 2013-2015 Giovanni Capuano <webmaster@giovannicapuano.net>
|
3
|
+
#
|
4
|
+
# This file is part of sottolio.
|
5
|
+
#
|
6
|
+
# sottolio is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# sottolio is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with sottolio. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
module Sottolio
|
20
|
+
class Script
|
21
|
+
include Enumerable
|
22
|
+
|
23
|
+
# TODO: Rid of unused methods
|
24
|
+
def initialize(scripts = [])
|
25
|
+
@var = []
|
26
|
+
scripts.each { |p| self << p }
|
27
|
+
end
|
28
|
+
|
29
|
+
def each(&block)
|
30
|
+
@var.each(&block)
|
31
|
+
end
|
32
|
+
|
33
|
+
def append(block)
|
34
|
+
instance_eval &block
|
35
|
+
end
|
36
|
+
alias_method :<<, :append
|
37
|
+
|
38
|
+
def has?(type)
|
39
|
+
@var.any? { |h| h.keys.first.to_sym == type.to_sym }
|
40
|
+
end
|
41
|
+
alias_method :include?, :has?
|
42
|
+
|
43
|
+
def length(type = nil)
|
44
|
+
if block_given?
|
45
|
+
@var.count &block
|
46
|
+
elsif type == nil
|
47
|
+
@var.count
|
48
|
+
else
|
49
|
+
@var.count { |h| h.keys.first.to_sym == type.to_sym }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
alias_method :count, :length
|
53
|
+
alias_method :count, :size
|
54
|
+
|
55
|
+
def get(type)
|
56
|
+
@var.select { |h| h.keys.first.to_sym == type.to_sym }
|
57
|
+
end
|
58
|
+
|
59
|
+
def first
|
60
|
+
@var.first
|
61
|
+
end
|
62
|
+
|
63
|
+
def last
|
64
|
+
@var.last
|
65
|
+
end
|
66
|
+
|
67
|
+
def pop
|
68
|
+
@var.pop
|
69
|
+
end
|
70
|
+
|
71
|
+
def reverse
|
72
|
+
@var.reverse
|
73
|
+
end
|
74
|
+
|
75
|
+
def reverse!
|
76
|
+
@var.reverse!
|
77
|
+
end
|
78
|
+
|
79
|
+
def to_s
|
80
|
+
@var.inspect
|
81
|
+
end
|
82
|
+
|
83
|
+
def method_missing(m, *args, &block)
|
84
|
+
if args.any?
|
85
|
+
args = args.first if args.length == 1
|
86
|
+
@var << { m.to_sym => args }
|
87
|
+
instance_variable_set "@#{m}", args
|
88
|
+
else
|
89
|
+
instance_variable_get "@#{m}"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|