montoc 0.0.2 → 0.0.3

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: 539a50accadd3cbb655b9115c6eaf68f77cd0199
4
- data.tar.gz: 00f9afd226b97d61a54ff136c144cea0fb679264
3
+ metadata.gz: 653a278a714010cbba7e0738f4a6a31a6f5e874d
4
+ data.tar.gz: 6fe51ebaa6cb77672cea6706cbae38e70728b193
5
5
  SHA512:
6
- metadata.gz: 3170b987660c1c9538bfe7c109e11567f852f83ff6dc0c3dc02393a700c6f053f590b7106e35c8b38c12b69b9b217bce8b375b6c7c99a13795ab3e4505d1072d
7
- data.tar.gz: c0bb2388b888d8911c9345959b2780d81e18985b2a3f589f6510225d3c5e31519d28034f5c936727ee8d989a5cda29bff757c7a6d7b217d8fa253c8bd8f30a9c
6
+ metadata.gz: 904ee7965d68c528c02cedb5683357815037c2ed262ced2b4905ead68b1225cdfd019e0b6d216fe5e66e929ccd17902d1cf7569bdf5f5533636afaa9e21564bc
7
+ data.tar.gz: aa86522f8d7608c68170af46b1ea2de67f276cc12ee8f27608260b80370e88c70dd0fa8af12772fbf28545121db481af40603104abf888cc7e9c4755b9603037
data/.gitignore CHANGED
@@ -1,9 +1,11 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
+ /lib/.yardoc/
3
4
  /Gemfile.lock
4
5
  /_yardoc/
5
6
  /coverage/
6
7
  /doc/
8
+ /lib/doc/
7
9
  /pkg/
8
10
  /spec/reports/
9
11
  /tmp/
@@ -1,7 +1,10 @@
1
+ # @author Adrian Setyadi
2
+ #
3
+
1
4
  require "montoc/version"
2
5
 
3
6
  module Montoc
4
- class TextMatrix
7
+ class DocBox
5
8
  attr_reader :text, :format
6
9
 
7
10
  def initialize text = ""
@@ -12,10 +15,26 @@ module Montoc
12
15
  yield self if block_given?
13
16
  end
14
17
 
18
+ # Override Object#to_s, so that puts or other methods call this
19
+ # method to get the string representation of this object
20
+ #
21
+ # @return [String] Return @text as the string representation of
22
+ # DocBox object.
15
23
  def to_s
16
24
  return @text
17
25
  end
18
26
 
27
+ @@original_text = {}
28
+ def self.experience docbox
29
+ fresh_key = docbox.object_id.to_s(36).to_sym
30
+ @@original_text[fresh_key] = docbox.instance_eval {@text}
31
+ end
32
+
33
+ def self.remember docbox
34
+ fresh_key = docbox.object_id.to_s(36).to_sym
35
+ return @@original_text[fresh_key]
36
+ end
37
+
19
38
  def + string
20
39
  @text = squeeze_space
21
40
  @text << string.to_s
@@ -25,8 +44,8 @@ module Montoc
25
44
  end
26
45
 
27
46
  def text= string
28
- @original = string
29
47
  @text = string
48
+ self.class.experience self
30
49
  end
31
50
 
32
51
  # Find the longest lines in text and return the first match.
@@ -96,10 +115,9 @@ module Montoc
96
115
  return matrix_arr
97
116
  end
98
117
 
99
-
100
118
  def virginize
101
119
  @format = :virgin
102
- @text = @original
120
+ @text = self.class.remember self
103
121
  return self
104
122
  end
105
123
 
@@ -316,7 +334,7 @@ module Montoc
316
334
 
317
335
  # Define alias methods
318
336
  method_aliases = %w{col column line row cols columns unmatricize
319
- squeeze_space! unmat squeeze_space! restore
337
+ squeeze_space! unmat squeeze_space! freshen
320
338
  virginize}
321
339
  method_aliases.each_slice(2) do |new_method, ori_method|
322
340
  alias_method new_method, ori_method
@@ -327,7 +345,7 @@ end
327
345
 
328
346
  class String
329
347
  def +(other)
330
- if other.kind_of? Montoc::TextMatrix
348
+ if other.kind_of? Montoc::DocBox
331
349
  new_text = self + other.text
332
350
  return new_text
333
351
  end
@@ -1,3 +1,3 @@
1
1
  module Montoc
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: montoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Setyadi
@@ -54,6 +54,23 @@ files:
54
54
  - LICENSE.txt
55
55
  - README.md
56
56
  - Rakefile
57
+ - lib/.yardoc/checksums
58
+ - lib/.yardoc/object_types
59
+ - lib/.yardoc/objects/root.dat
60
+ - lib/.yardoc/proxy_types
61
+ - lib/doc/_index.html
62
+ - lib/doc/class_list.html
63
+ - lib/doc/css/common.css
64
+ - lib/doc/css/full_list.css
65
+ - lib/doc/css/style.css
66
+ - lib/doc/file_list.html
67
+ - lib/doc/frames.html
68
+ - lib/doc/index.html
69
+ - lib/doc/js/app.js
70
+ - lib/doc/js/full_list.js
71
+ - lib/doc/js/jquery.js
72
+ - lib/doc/method_list.html
73
+ - lib/doc/top-level-namespace.html
57
74
  - lib/montoc.rb
58
75
  - lib/montoc/version.rb
59
76
  - montoc.gemspec