mindwords 0.6.5 → 0.6.6

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
  SHA256:
3
- metadata.gz: 7510e9608c67e4af590bf024b9910a592c28c6f949d66d37499f940265b5e9d0
4
- data.tar.gz: f982e7b27d1cd9d230d2f2783bf89a75d296ae0bcf6c32324aeb2d089fab113a
3
+ metadata.gz: ec2890a679fe960fc09d401fc33fa57c735b4e8ba940dfa02834880d2f92320a
4
+ data.tar.gz: 2829b18b62650d5f49986113e67e01127331b89e17aaee698219220f3fae6387
5
5
  SHA512:
6
- metadata.gz: eb7c8532b2a5a46edace11d960f568b306b01ef3edd8c45557176451d158b42ae57e1ee3818c1df9ac202bdd17aefde8bbd2e036d913b40d57caed7d365749d1
7
- data.tar.gz: d50c913670f4a5c567b5a9c81c0f1c3ef3c9293957a91128befb76196dc672e075b4f2db925a4e1156f269ab1963cbdf774192b739c9e8a4eb7b634640e969d8
6
+ metadata.gz: cd62b5aa44b6227a0028e990369dfa582d0b5c32bbee93969a37456cdc2e787d6d25108d3f4279e1422bd95ce107c01622b9167ab43407c2aa0627a6d0ec2989
7
+ data.tar.gz: af4672aef859de43270d5a16d422815670e7e093282a19c901358d2770fd95276080c1594125a3215c3b0f1ce9b17d9ed6603b6e91dd6ae05b8b2764fb1484cc
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/mindwords.rb CHANGED
@@ -26,33 +26,7 @@ class MindWords
26
26
 
27
27
  @parent, @debug = parent, debug
28
28
 
29
- s, type = RXFHelper.read raws
30
-
31
- @filepath = raws if type == :file or type == :dfs
32
- lines = (s.strip.gsub(/(^\n|\r)/,'') + "\n").lines.uniq
33
- lines.shift if lines.first =~ /<\?mindwords\?>/
34
-
35
- @lines = lines.inject([]) do |r,line|
36
-
37
- # the following does 2 things:
38
- # 1. splits words separated by a bar (|) onto their own line
39
- # 2. prefixes a word with an underscore if the word is the
40
- # same as the hashtag. That way it's not removed by the
41
- # redundancy checker
42
-
43
- raw_words, raw_hashtags = line.split(/(?= #)/,2)
44
- words = raw_words.split(/ *\| */)
45
- hashtags = raw_hashtags.scan(/(?<=#)\w+/)
46
-
47
- words.each do |word|
48
-
49
- linex = (word + raw_hashtags)
50
- r << (hashtags.include?(word) ? linex.sub!(/\b#{word}\b/, '_\0') \
51
- : linex)
52
- end
53
-
54
- r
55
- end
29
+ import(raws) if raws.length > 1
56
30
 
57
31
  end
58
32
 
@@ -95,6 +69,37 @@ class MindWords
95
69
 
96
70
  end
97
71
 
72
+ def import(raws)
73
+
74
+ s, type = RXFHelper.read raws
75
+
76
+ @filepath = raws if type == :file or type == :dfs
77
+ lines = (s.strip.gsub(/(^\n|\r)/,'') + "\n").lines.uniq
78
+ lines.shift if lines.first =~ /<\?mindwords\?>/
79
+
80
+ @lines = lines.inject([]) do |r,line|
81
+
82
+ # the following does 2 things:
83
+ # 1. splits words separated by a bar (|) onto their own line
84
+ # 2. prefixes a word with an underscore if the word is the
85
+ # same as the hashtag. That way it's not removed by the
86
+ # redundancy checker
87
+
88
+ raw_words, raw_hashtags = line.split(/(?= #)/,2)
89
+ words = raw_words.split(/ *\| */)
90
+ hashtags = raw_hashtags.scan(/(?<=#)\w+/)
91
+
92
+ words.each do |word|
93
+
94
+ linex = (word + raw_hashtags)
95
+ r << (hashtags.include?(word) ? linex.sub!(/\b#{word}\b/, '_\0') \
96
+ : linex)
97
+ end
98
+
99
+ r
100
+ end
101
+ end
102
+
98
103
  # helpful when searching for a word itself using autosuggest
99
104
  #
100
105
  def lookup(s)
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mindwords
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  aWH7D2AmhOpqNwWnPHzWR/yzpigAVTrvpHfRxZleQj6Z/090nIH2KR0RdioMmPFq
36
36
  3+574KQzs/gR9Y5a+iMcvHRN
37
37
  -----END CERTIFICATE-----
38
- date: 2022-01-01 00:00:00.000000000 Z
38
+ date: 2022-01-02 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: line-tree
metadata.gz.sig CHANGED
Binary file