simple_munou 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +33 -1
- data/lib/simple_munou.rb +11 -2
- data/lib/simple_munou/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e4101d19a631dd2a3ca602d9086cb683fea412b
|
4
|
+
data.tar.gz: a25aededdffb5a84867e578517b70faecd3ee415
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2166e8fab79cd4347c15c487b81ff0a6ff945f3f25744d8f1120aee276fac4e57da7158c40435385a0314b8c94fddde809251f56a341594e6b93e5c9f3153198
|
7
|
+
data.tar.gz: 2f48fdb6aea1d993d8145373ab9783d6b1bfc67cd0e3a658ccbce40b45675946914c64f616c229765bf2d0f2390d6efb8edc27f26aced20de9d7e19b1d6b045f
|
data/README.md
CHANGED
@@ -20,7 +20,39 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
|
23
|
+
### Example
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
munou = [1, "is", 1].to_munou
|
27
|
+
munou.words = [["foo", 1], ["bar", 1]]
|
28
|
+
munou.say # => "foo is bar" or "bar is foo" or ...
|
29
|
+
```
|
30
|
+
|
31
|
+
### Pattern
|
32
|
+
|
33
|
+
Use Array Object.
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
munou = [1, "is", 1].to_munou
|
37
|
+
```
|
38
|
+
|
39
|
+
Fixnum means kind of number.
|
40
|
+
If you use same words, symbol is useful.
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
munou = [:x_1, "is", :x_1]
|
44
|
+
```
|
45
|
+
|
46
|
+
Symbol is key and kind of number. example :x_1, key is x, and type is 1.
|
47
|
+
If use all word, use -1.
|
48
|
+
|
49
|
+
### Word
|
50
|
+
|
51
|
+
`words=` modify 2 size arrays to word objects.
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
munou.words = [["foo", 1], SimpleMunou::Word.new("bar", 2)]
|
55
|
+
```
|
24
56
|
|
25
57
|
## Contributing
|
26
58
|
|
data/lib/simple_munou.rb
CHANGED
@@ -32,8 +32,17 @@ module SimpleMunou
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
36
|
-
|
35
|
+
def pattern=(talk_pattern)
|
36
|
+
if talk_pattern.class == Array
|
37
|
+
@pattern = talk_pattern
|
38
|
+
else
|
39
|
+
fail TypeError, "Pattern must be Array."
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def say(variables = nil)
|
44
|
+
@variables = variables
|
45
|
+
@variables = {} if @variables.nil?
|
37
46
|
@pattern.map do |p|
|
38
47
|
case p
|
39
48
|
when Fixnum
|
data/lib/simple_munou/version.rb
CHANGED