simple_attribute 0.1.3 → 0.1.4

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: 5a84ac7a80f0837ac35807f6406dfcd7a0624ca7793dd545f80f365c951fb845
4
- data.tar.gz: 4d989113362d936ca25f234e45b1c3ae80d137b99c8178ecd84807f1042af974
3
+ metadata.gz: '06569cfdd5cd4f87f9d7fdb641192d4bed7d47fab33d4687cf19fc0f898a117e'
4
+ data.tar.gz: 47ec2da68ff2e219f39e85bbe69837afc625bb38dc7a32e8e97460298456e66a
5
5
  SHA512:
6
- metadata.gz: ec335fbdb9de65566f03827661e1e470db7af2fa705c941d4c2bb4593ad2aca7e17517f5442cdb57e299d22e34ede2797feee783cf54a8fb6f05e69b0fb8d295
7
- data.tar.gz: 4a4b6ea002b093ab7803084933770d1d49e030f401c3557a871b4bc2651ff35f3985c9e6aae420345c5fb5fe10dfe2880831467f94092d173c7c944f4dbb7af0
6
+ metadata.gz: 3f295ff9486b5d45827bc5283df99e36008201752394a821c1aaf9630173bf8baa5bbf284fa8865e47c2c06e0de56d842760eedca5ddc3aece07f27d066a8c45
7
+ data.tar.gz: f06ef71bd2ab163e9bdde6aa6388c537c8a86f266b49ee59eb45b5afd992a8047dd74659a7275534cf4cf6597a602a77c652a7ec9d67591ab6118d42573c7c89
@@ -14,5 +14,6 @@ module SimpleAttribute
14
14
  autoload :Association
15
15
  autoload :Enumeration
16
16
  autoload :File
17
+ autoload :Money
17
18
  end
18
19
  end
@@ -59,6 +59,11 @@ module SimpleAttribute
59
59
  "#{attribute}".dasherize
60
60
  end
61
61
 
62
+ # Attribute label method
63
+ def label_method
64
+ @options.fetch(:label, :to_s)
65
+ end
66
+
62
67
  # Attribute html options
63
68
  def html_options
64
69
  options.fetch :html, {}
@@ -82,7 +87,7 @@ module SimpleAttribute
82
87
 
83
88
  # Render attribute
84
89
  def render_attribute
85
- "#{value || default_value}".html_safe
90
+ "#{value.try(label_method)}".html_safe
86
91
  end
87
92
 
88
93
  # Render attribute or default
@@ -0,0 +1,10 @@
1
+ module SimpleAttribute
2
+ module Attributes
3
+ class Money < Base
4
+ # Render attribute
5
+ def render_attribute
6
+ value.try :format
7
+ end
8
+ end
9
+ end
10
+ end
@@ -1,3 +1,3 @@
1
1
  module SimpleAttribute
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_attribute
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonian Guveli
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-25 00:00:00.000000000 Z
11
+ date: 2018-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -118,6 +118,7 @@ files:
118
118
  - lib/simple_attribute/attributes/file.rb
119
119
  - lib/simple_attribute/attributes/image.rb
120
120
  - lib/simple_attribute/attributes/link.rb
121
+ - lib/simple_attribute/attributes/money.rb
121
122
  - lib/simple_attribute/attributes/video.rb
122
123
  - lib/simple_attribute/builder.rb
123
124
  - lib/simple_attribute/config.rb