internal_name_helper 0.1.0 → 0.2.5

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.
data/README.md CHANGED
@@ -1,9 +1,13 @@
1
1
  Internal Name Helper for Active Model
2
2
  ====================
3
3
 
4
- Pre-Load all records from database, then generate helper methods.
4
+ Pre-Load all records from database, then generate some helper methods.
5
5
 
6
- For example
6
+ Since all records will be pre-loaded, and stored in the Rails instance. This is not suitable for large models.
7
+
8
+ ## Scenarios:
9
+
10
+ ### Plan
7
11
 
8
12
  There are 3 plans in the Plan model
9
13
 
@@ -12,19 +16,43 @@ lite
12
16
  standard
13
17
  pro
14
18
 
19
+ Include the module in Model part
20
+
21
+ ```ruby
22
+ gem 'internal_name_helper'
23
+ ```
24
+
25
+ ```ruby
26
+ class Plan < ActiveRecord::Base
27
+ include InternalNameHelper::Methods
28
+ end
29
+ ```
30
+
15
31
  The following methods will be generated
16
32
 
33
+ Class Methods
34
+
35
+ ```ruby
36
+ Plan.lite
37
+ Plan.standard
38
+ Plan.pro
39
+ ```
40
+
41
+ Instance Methods
42
+
17
43
  ```ruby
18
- Plan.lite
19
- Plan.standard
20
- Plan.pro
44
+ plan.is_lite?
45
+ plan.is_not_lite?
46
+ plan.is_standard?
47
+ plan.is_not_standard?
48
+ plan.is_pro?
49
+ plan.is_not_pro?
21
50
  ```
22
51
 
52
+ Examples
53
+
23
54
  ```ruby
24
- plan.is_lite?
25
- plan.is_not_lite?
26
- plan.is_standard?
27
- plan.is_not_standard?
28
- plan.is_pro?
29
- plan.is_not_pro?
30
- ```
55
+ @current_plan = Plan.lite
56
+ if @current_plan.is_lite?
57
+ end
58
+ ```
@@ -1,3 +1,3 @@
1
1
  module InternalNameHelper
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.2.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: internal_name_helper
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 0
10
- version: 0.1.0
8
+ - 2
9
+ - 5
10
+ version: 0.2.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Elan Meng
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2014-06-09 00:00:00 +08:00
18
+ date: 2014-06-10 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies: []
21
21