azahara_schema 0.3.4 → 0.3.5

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: 196087578480940bd53363da2e160d13b2af3eb4cd42f4bedfef44493993f2bf
4
- data.tar.gz: 1c63360964ae78ff48f082219b9c8a1a75d07a63a74562380432cd67a62e67b9
3
+ metadata.gz: f94ff9042c2246d38dbfabfc0b4935c0e3e187cdee2a98f23bf6f37c25b4defa
4
+ data.tar.gz: 301ab4cbe1764857c16f9c26e69e607a2bac6c5be3ee335e9cd7ec63ca8c426b
5
5
  SHA512:
6
- metadata.gz: 68c48995f02cc99264f29bfb43cb231c2edee15eb66dacc5dce937d60e689d02855e69c4e44191b5b25f5f085e3c6ebc4834acdb186b64e20386ed093e370561
7
- data.tar.gz: 420e5d0d41851c0a60783a6746c8514f4e44c99ad6e8b4afecbc2c84621d5797940aaab391288d7470d3272c3414114a21c9b0b5d3ef7d8a8c00a5c31a9d8109
6
+ metadata.gz: 9a72b9632ec5e74ff694b679fcd37dbee464dbf37300941a52b4c55312055b8bbaee54c3e2dd9f1fe2527c414f53c09dbacee7ff834528a0f99ea46b70101139
7
+ data.tar.gz: 5ada7cf0f14f608d304bd7f1b6a93baa6ea7d19d76ad287486b42445251507b037ac92a26e90bb2a88ebb3878c9e509ca76f665dc20cb32233fc847a82b5bdef
@@ -60,11 +60,11 @@ module AzaharaSchema
60
60
  end
61
61
 
62
62
  def formatted_value(attribute, entity, **options)
63
- real_formatter(attribute).format_value(attribute, attribute_human_value(attribute, entity), options)
63
+ real_formatter(attribute).format_value(attribute, attribute_human_value(attribute, entity), formatting_options(attribute,entity).merge(options))
64
64
  end
65
65
 
66
66
  def html_formatted_value(attribute, entity, **options)
67
- format_value_html(attribute, attribute.value(entity), options)
67
+ format_value_html(attribute, attribute.value(entity), formatting_options(attribute,entity).merge(options))
68
68
  end
69
69
 
70
70
  def attribute_html_label(attribute, **options)
@@ -94,6 +94,10 @@ module AzaharaSchema
94
94
  formated_value = real_formatter(attribute).format_value(attribute, unformated_value, options)
95
95
  end
96
96
 
97
+ def formatting_options(attribute, entity)
98
+ {}
99
+ end
100
+
97
101
  def real_formatter(attribute)
98
102
  if attribute.respond_to?(:attribute)
99
103
  self.class.formatter_for(attribute.attribute.model).new(attribute.attribute.model, template, @options).real_formatter(attribute.attribute)
@@ -81,6 +81,10 @@ module AzaharaSchema
81
81
 
82
82
  class FloatFormat < NumberFormat
83
83
  add 'float'
84
+
85
+ def sanitize_value(value)
86
+ value.to_s.present? ? value.to_s.to_f : nil
87
+ end
84
88
  end
85
89
 
86
90
  class DecimalFormat < FloatFormat
@@ -243,7 +243,7 @@ module AzaharaSchema
243
243
 
244
244
  def entity_scope
245
245
  scope = model.respond_to?(:visible) ? model.visible : model.all
246
- scope.send(self.default_scope) if self.default_scope
246
+ scope = scope.send(self.default_scope) if self.default_scope
247
247
  scope
248
248
  end
249
249
 
@@ -1,3 +1,3 @@
1
1
  module AzaharaSchema
2
- VERSION = '0.3.4'
2
+ VERSION = '0.3.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: azahara_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Ezr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-19 00:00:00.000000000 Z
11
+ date: 2018-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails