user_text 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd82154688a4aef7c73d41f9ce4a8a02f673fd61ab4ff52cc541eca815d58e18
4
- data.tar.gz: ea83d7977e1500bfc0904af61ef2bf587e166938c96f9c02020bd6adae3bf53a
3
+ metadata.gz: '009d3afc2a1af0552dce447efd23a45f8174be44eecdb3fdecada622f538cd9b'
4
+ data.tar.gz: d670ee4f4553b670fedd252d8a64edf725bb1e987b8735a4ece7e17aa9cb90ea
5
5
  SHA512:
6
- metadata.gz: 7f61492cb4a712874fc0a051916582d261c9594cd1ac1d9ef290ec8482a0c759425c0ea10f1195ff0bce9d2f2ce4caeb38976cfc498d5148f7957871efa38ebb
7
- data.tar.gz: ae01ed720ff2b8bf8976e4b7f98187f50d8d3132ee5f721b2a7da314324f49b9c49e79bc8989367e982146eddfeb815f098bfa3a6b891c5f8bcb55269e5bc45e
6
+ metadata.gz: db8d66450a32052a80062aac26838cd6e65cd9922073d7f0914fd7c3661ee4570c723048eaf7b448967a4d3d1fb89d7ba50e9d0161844106f2bbc4a4c27197b4
7
+ data.tar.gz: b94db60ce4ecde96c4a50fc91f6fb8bb02c52bb77108b28c18c03e8975182e5482d04c11ef6599899734e8fc8e36e9335be0ff851d2b12f3423b40614014cc26
data/.rubocop.yml ADDED
@@ -0,0 +1,20 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ TargetRubyVersion: 3.0
4
+
5
+ # String literals use double quotes.
6
+ Style/StringLiterals:
7
+ EnforcedStyle: double_quotes
8
+
9
+ # Do not use frozen_string_literal comment.
10
+ Style/FrozenStringLiteralComment:
11
+ Enabled: false
12
+
13
+ Style/HashSyntax:
14
+ Enabled: false
15
+
16
+ Style/Documentation:
17
+ Enabled: false
18
+
19
+ Layout/LineLength:
20
+ Max: 160
data/README.md CHANGED
@@ -1,24 +1,34 @@
1
1
  # UserText
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
4
-
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/user_text`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ `UserText` is a gem to format the input by user.
6
4
 
7
5
  ## Installation
8
6
 
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
-
11
7
  Install the gem and add to the application's Gemfile by executing:
12
8
 
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
9
+ ```
10
+ $ bundle add user_text
11
+ ```
14
12
 
15
13
  If bundler is not being used to manage dependencies, install the gem by executing:
16
14
 
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
15
+ ```
16
+ $ gem install user_text
17
+ ```
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ ```ruby
22
+ text = <<EOS
23
+ Hello, World!
24
+
25
+ My email address is user@example.com
26
+
27
+ https://example.com/path/to/page
28
+ EOS
29
+ UserText.format(text)
30
+ # => "Hello, World!<br><br>My email address is <a href=\"mailto:user@example.com\">user@example.com</a><br><br><a href=\"https://example.com/path/to/page\" target=\"_blank\">https://example.com/path/to/page</a><br>"
31
+ ```
22
32
 
23
33
  ## Development
24
34
 
data/Rakefile CHANGED
@@ -1,4 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bundler/gem_tasks"
4
- task default: %i[]
4
+ require "rspec/core/rake_task"
5
+ require "rubocop/rake_task"
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+ RuboCop::RakeTask.new
9
+
10
+ task :default => %i[spec rubocop]
@@ -5,17 +5,17 @@ module UserText
5
5
  end
6
6
 
7
7
  def nl2br(text)
8
- text.gsub(/\R/) { %Q{<br>} }
8
+ text.gsub(/\R/) { %(<br>) }
9
9
  end
10
10
 
11
11
  def url2a(text)
12
- text.gsub(URI::DEFAULT_PARSER.make_regexp(%w[http https])) {
13
- %Q{<a href="#{Regexp.last_match(0)}" target="_blank">#{Regexp.last_match(0)}</a>}
14
- }
12
+ text.gsub(URI::DEFAULT_PARSER.make_regexp(%w[http https])) do
13
+ %(<a href="#{Regexp.last_match(0)}" target="_blank">#{Regexp.last_match(0)}</a>)
14
+ end
15
15
  end
16
16
 
17
17
  def email2a(text)
18
- text.gsub(/[\w+\-.]+@[a-z\d\-.]+\.[a-z]+/i) { %Q{<a href="mailto:#{Regexp.last_match(0)}">#{Regexp.last_match(0)}</a>} }
18
+ text.gsub(/[\w+\-.]+@[a-z\d\-.]+\.[a-z]+/i) { %(<a href="mailto:#{Regexp.last_match(0)}">#{Regexp.last_match(0)}</a>) }
19
19
  end
20
20
 
21
21
  def user_text_sanitize(text)
@@ -26,4 +26,4 @@ module UserText
26
26
  @user_text_sanitizer ||= Rails::HTML5::FullSanitizer.new
27
27
  end
28
28
  end
29
- end
29
+ end
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  module UserText
4
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
5
3
  end
data/lib/user_text.rb CHANGED
@@ -8,4 +8,10 @@ require_relative "user_text/version"
8
8
 
9
9
  module UserText
10
10
  extend ::UserText::Helper
11
+
12
+ class << self
13
+ def format(text)
14
+ user_text(text)
15
+ end
16
+ end
11
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: user_text
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - i2bskn
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: pry
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
41
  description: user_text
56
42
  email:
57
43
  - i2bskn@gmail.com
@@ -59,6 +45,7 @@ executables: []
59
45
  extensions: []
60
46
  extra_rdoc_files: []
61
47
  files:
48
+ - ".rubocop.yml"
62
49
  - LICENSE.txt
63
50
  - README.md
64
51
  - Rakefile
@@ -73,6 +60,7 @@ metadata:
73
60
  homepage_uri: https://github.com/i2bskn/user_text
74
61
  source_code_uri: https://github.com/i2bskn/user_text
75
62
  changelog_uri: https://github.com/i2bskn/user_text/blob/master/CHANGELOG.md
63
+ rubygems_mfa_required: 'true'
76
64
  post_install_message:
77
65
  rdoc_options: []
78
66
  require_paths: