tramway-core 1.13.1 → 1.13.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: 9f17da8e39166fb8bf4ed6efd78f50c7b2424e4c296b59a547614b1ee2eb5c8d
4
- data.tar.gz: afe057eca20f716dd777be50de34edbc2ace1d301507a6d0e6345581338a25dd
3
+ metadata.gz: 98fc3b4eb72607b71692a66f9984842cc63cd135f7c498090b5a89ec22d25648
4
+ data.tar.gz: 955159d6eb34fc36e753a3aba3167846a788a7ce37e9e5d3d657fb542c0d6312
5
5
  SHA512:
6
- metadata.gz: 1baf5692c4e9d0b6cf6471974ff2ea3b95fb673907bd890b081aca651f3685fa6e049a2641bf90d4578b45e5d90c7907956845ec2b179aae795fec53d5f6db0c
7
- data.tar.gz: de8110872ce9bcae012fa705104c1d30a1474fa41919810d15831baf9fe39177d1b0e3a688e59f2216f06d1f3c60489bb0369822307793c2c78e9043bee7d1b3
6
+ metadata.gz: 8901bf8f3c13d43b4bc750dfef901e079bc351eae922674883066ffffaca448c7ba5c3913ef96bf7caed2f52d1872358780295d3dd46c07178f758b6e5ab35b5
7
+ data.tar.gz: ceb839ae0aa3d97d75a0e7c98c212bd8502ad21f8f411d20871bce24f608fd7818d67284ed271a0ffa22515d8c47b0403422f9aa0aa559b0b66f9e174c0cf2c5
@@ -111,8 +111,17 @@ class Tramway::Core::ApplicationDecorator
111
111
 
112
112
  include Tramway::Core::Concerns::AttributesDecoratorHelper
113
113
 
114
+ RESERVED_WORDS = [ 'fields' ]
115
+
114
116
  def attributes
115
117
  object.attributes.reduce({}) do |hash, attribute|
118
+ if attribute[0].in? RESERVED_WORDS
119
+ error = Tramway::Error.new(
120
+ plugin: :core,
121
+ method: :attributes,
122
+ message: ("Method `#{attribute[0]}` is reserved word. Please, create or delegate method in #{self.class.name} with another name."))
123
+ raise error.message
124
+ end
116
125
  value = try(attribute[0]) ? send(attribute[0]) : object.send(attribute[0])
117
126
  if attribute[0].to_s.in? object.class.state_machines.keys.map(&:to_s)
118
127
  hash.merge! attribute[0] => state_machine_view(object, attribute[0])
@@ -3,19 +3,19 @@ class Tramway::Core::ExtendedApplicationForm < Tramway::Core::ApplicationForm
3
3
  def properties(*args)
4
4
  @@extendable_properties ||= []
5
5
  @@extendable_properties += args
6
- super *args
6
+ super(*args)
7
7
  end
8
8
  end
9
9
 
10
- def initialize(model)
11
- @@extendable_properties.each do |prop|
12
- unless model.respond_to? prop
13
- model.class.define_method prop do
14
- end
15
- model.class.define_method "#{prop}=" do |value|
16
- end
10
+ def initialize(model)
11
+ @@extendable_properties.each do |prop|
12
+ unless model.respond_to? prop
13
+ model.class.define_method prop do
14
+ end
15
+ model.class.define_method "#{prop}=" do |value|
17
16
  end
18
17
  end
19
- super
20
18
  end
19
+ super
20
+ end
21
21
  end
@@ -1,5 +1,5 @@
1
1
  module Tramway
2
2
  module Core
3
- VERSION = '1.13.1'
3
+ VERSION = '1.13.1.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.1
4
+ version: 1.13.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-05 00:00:00.000000000 Z
11
+ date: 2019-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: reform-rails