acts_as_mentionable 0.2.0 → 0.2.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: a9e8c57fc330401901ba129fabddc2b3383f0c93b018a7bedf86f7a1c98a4835
4
- data.tar.gz: da143817eb31788245c13d3ae16e978320db6f8d78de4bdfd1c66405e61df5e8
3
+ metadata.gz: d9044c1db8eb718ee2f4493ad2457f2528436fa715abf545936c8888f001e600
4
+ data.tar.gz: 95cdbfb74522f66963143296e0469be2c9ba7a9ce4b4822f162d2371114fc297
5
5
  SHA512:
6
- metadata.gz: ab5f7ababfd7e3dc833d1a63fde4c1fb1516d636843d80853cb448b274f134bd4a088ec6be6b183278b08746799ff508a38ef76de021e611c783ba8e37c9f76e
7
- data.tar.gz: 215a73fc8de11cb20c7c3caf465cdf31cbc1a50dc8a9c7a36158010c1d88fc51378b46796b0a02d58f8768c82c4b7cf4f7348a6979f2d363f38b1aef4bbf535d
6
+ metadata.gz: 20e1b3c472ecce5c273e7c11d78195091bf74dee4e106e2b46fb368494522798357cfab124d62657c606ffde8aaefa633fa3d2561b6bb094212d20914c58ca88
7
+ data.tar.gz: 64a955a69a73bb655ace131d279e2895de739495ba0b1ef770ade7cc6eea4e06c39592acc5efc357602014ed51bd017c26ddc18ad52b929e8b703be4fb23ba07
data/README.md CHANGED
@@ -58,7 +58,7 @@ end
58
58
  ```
59
59
 
60
60
  Mentioner (`Comment`) model is expected to have two fields:
61
- 1. The field, which contains, let's say, plain version of the comment - in the example above it's `body`. This field, by default, is rewritten by the parser and contains all the mentions as the plain text, e.g. `Hello, @john!`.
61
+ 1. The field, which contains, let's say, plain version of the comment - in the example above it's `body`. This field, by default, is rewritten by the parser and contains all the mentions as the plain text, e.g. `Hello, *U+2063*@john*U+2063*!`. The character `*U+2063*` is used to show the beginning and end of a mention
62
62
  2. The field, which contains comment with the mentions. It's named as the `parsed_*`, where `*` is meant to be the field, which contains plain version of the comment. In the example above it's named `parsed_body`. Mentions are recognized by the following template - `{#|RECORD_ID|RECORD_MODEL_NAME}`, where `RECORD_ID` is the ID of record being mentioned, for instance, user ID, and, `RECORD_MODEL_NAME` is the name of the model being mentioned, for instance, for `User` model it is `user`. According to this, `parsed_body` field may have the following value - `Hello, {#|42|user}!`.
63
63
 
64
64
  So, as you may have already noticed, the argument provided to the `#acts_as_mentioner` method is the name of the field, which is a plain version of the comment - `body`, and the name of the field, which contains mentions is generated automatically - `parsed_body`.
@@ -83,9 +83,9 @@ The argument `username` provided to `#acts_as_mentionable` method, is a field on
83
83
  user = User.create! id: 42, username: 'john'
84
84
  comment = Comment.create! parsed_body: 'Hello, {#|42|user}!'
85
85
  puts comment.body
86
- # => Hello, @john!
86
+ # => Hello, *U+2063*@john*U+2063*!
87
87
  ```
88
- As you can see, it this case `{#|42|user}` in `parsed_body` is replaced by `@` + `username` field of the user in comment's `body`.
88
+ As you can see, it this case `{#|42|user}` in `parsed_body` is replaced by `*U+2063*` + `@` + `username` + `*U+2063*` field of the user in comment's `body`.
89
89
 
90
90
  ### Retrieving mentions
91
91
 
@@ -32,7 +32,7 @@ module ActsAsMentionable
32
32
 
33
33
  def metionable_template mentionable, template
34
34
  if mentionable.respond_to?(:mentionable?) && mentionable.mentionable?
35
- "<U+2063>@#{mentionable.send(mentionable.class.mentionable_field)}<U+2063>"
35
+ "*U+2063*@#{mentionable.send(mentionable.class.mentionable_field)}*U+2063*"
36
36
  else
37
37
  template
38
38
  end
@@ -1,3 +1,3 @@
1
1
  module ActsAsMentionable
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.2.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_mentionable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Baron Bloomer
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2019-06-18 00:00:00.000000000 Z
13
+ date: 2019-06-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord