simple_munou 0.0.1 → 0.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f6e053ed2601902e8a89fe2755aec441874acbd8
4
- data.tar.gz: d97fd87aa24f670697edb4e158107270077d34a5
3
+ metadata.gz: 2e4101d19a631dd2a3ca602d9086cb683fea412b
4
+ data.tar.gz: a25aededdffb5a84867e578517b70faecd3ee415
5
5
  SHA512:
6
- metadata.gz: 5a5b0fa7a6cc15a98b9caa6a1813929b7112e48c1dec3c28e495d113061c93d3a8d2ca07fce2adafd02b0ccac079406d1c465805dfa1f4f74876131e8ea06d91
7
- data.tar.gz: 46725cc5c3aea7f337b4da81a7dee00463efd211f2ae32737ced6c1d59a4394f9ba13f3fa74a2e8d3eae0c0c07829ec6668308fcf39a74df924f88901219872d
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
- TODO
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 say
36
- @variables = {}
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
@@ -1,3 +1,3 @@
1
1
  module SimpleMunou
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_munou
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - esehara shigeo