tbpgr_utils 0.0.106 → 0.0.107

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -99,6 +99,7 @@ Or install it yourself as:
99
99
  |[MarkdownString.heading4](#markdownstringheading4) |Return markdown heading level4 from text |
100
100
  |[MarkdownString.heading5](#markdownstringheading5) |Return markdown heading level5 from text |
101
101
  |[MarkdownString.heading6](#markdownstringheading6) |Return markdown heading level6 from text |
102
+ |[MarkdownString.ul](#markdownstringul) |Return markdown ul from arrau |
102
103
  |[MetasyntacticVariable](#metasyntacticvariable) |META variable, META variable for classes |
103
104
  |[TbpgrUtils Module.alias_methods](#modulealias_methods) |create alias methods |
104
105
  |[TbpgrUtils Numeric#dice_back](#numericdice_back) |return dice back number |
@@ -2351,6 +2352,45 @@ MarkdownString.heading6(12345) # => "###### 12345"
2351
2352
 
2352
2353
  [back to list](#list)
2353
2354
 
2355
+ ### MarkdownString.ul
2356
+ case list
2357
+ ~~~ruby
2358
+ require 'markdown_string'
2359
+ MarkdownString.ul(%w{a b c})
2360
+ ~~~
2361
+
2362
+ result
2363
+ ~~~
2364
+ * a
2365
+ * b
2366
+ * c
2367
+ ~~~
2368
+
2369
+ case not list
2370
+ ~~~ruby
2371
+ require 'markdown_string'
2372
+ MarkdownString.ul("test") # => "test"
2373
+
2374
+ case nil list
2375
+ ~~~ruby
2376
+ require 'markdown_string'
2377
+ MarkdownString.ul([nil, nil])
2378
+ ~~~
2379
+
2380
+ result
2381
+ ~~~
2382
+ *
2383
+ *
2384
+ ~~~
2385
+
2386
+ case empty list
2387
+ ~~~ruby
2388
+ require 'markdown_string'
2389
+ MarkdownString.ul([]) # => ""
2390
+ ~~~
2391
+
2392
+ [back to list](#list)
2393
+
2354
2394
  ### MetasyntacticVariable
2355
2395
  * META variable
2356
2396
 
@@ -3345,6 +3385,7 @@ if you are Sublime Text2 user, you can use snippet for TbpgrUtils.
3345
3385
  https://github.com/tbpgr/tbpgr_utils_snippets
3346
3386
 
3347
3387
  ## History
3388
+ * version 0.0.107 : add MarkdownString#ul
3348
3389
  * version 0.0.106 : add MarkdownString#heading3, heading4, heading5, heading6
3349
3390
  * version 0.0.105 : add MarkdownString#heading2
3350
3391
  * version 0.0.104 : add MarkdownString#heading1. remove File.insert_bom.
@@ -0,0 +1,44 @@
1
+ # encoding: utf-8
2
+
3
+ class MarkdownString
4
+ # Return markdown heading level1-6 from text
5
+ #
6
+ # === Example
7
+ #
8
+ # case list
9
+ #
10
+ # MarkdownString.ul(%w{a b c})
11
+ #
12
+ # result
13
+ #
14
+ # * a
15
+ # * b
16
+ # * c
17
+ #
18
+ # case not list
19
+ #
20
+ # MarkdownString.ul("test") # => "test"
21
+ #
22
+ # case nil list
23
+ #
24
+ # MarkdownString.ul([nil, nil])
25
+ #
26
+ # result
27
+ #
28
+ # *
29
+ # *
30
+ #
31
+ # case empty list
32
+ #
33
+ # MarkdownString.ul([]) # => ""
34
+ #
35
+ def self.ul(list)
36
+ return list unless list.is_a?(Array)
37
+ return '' if list.empty?
38
+ list.reduce([]) do |ret, elm|
39
+ elm = '' if elm.nil?
40
+ ret << "* #{elm}"
41
+ ret
42
+ end.join("\n") + "\n"
43
+ end
44
+ end
@@ -1,3 +1,4 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require 'markdown/heading'
4
+ require 'markdown/ul'
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Tbpgr Utilities
4
4
  module TbpgrUtils
5
- VERSION = '0.0.106'
5
+ VERSION = '0.0.107'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tbpgr_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.106
4
+ version: 0.0.107
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-23 00:00:00.000000000 Z
12
+ date: 2014-04-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &22500996 !ruby/object:Gem::Requirement
16
+ requirement: &21118152 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 4.0.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *22500996
24
+ version_requirements: *21118152
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &22500708 !ruby/object:Gem::Requirement
27
+ requirement: &21117864 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.3'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *22500708
35
+ version_requirements: *21117864
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &22500480 !ruby/object:Gem::Requirement
38
+ requirement: &21117636 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *22500480
46
+ version_requirements: *21117636
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &22500156 !ruby/object:Gem::Requirement
49
+ requirement: &21117312 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 2.14.1
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *22500156
57
+ version_requirements: *21117312
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: simplecov
60
- requirement: &22499856 !ruby/object:Gem::Requirement
60
+ requirement: &21117012 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: 0.8.2
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *22499856
68
+ version_requirements: *21117012
69
69
  description: Utilities
70
70
  email:
71
71
  - tbpgr@tbpgr.jp
@@ -109,6 +109,7 @@ files:
109
109
  - lib/familyable/person.rb
110
110
  - lib/ghostable.rb
111
111
  - lib/markdown/heading.rb
112
+ - lib/markdown/ul.rb
112
113
  - lib/markdown_string.rb
113
114
  - lib/metasyntactic_variable.rb
114
115
  - lib/open_classes/array.rb