immutabler 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 082cae15547802583d920c85a676e4c5cf93302d
4
- data.tar.gz: 0c607875a8e602d62a7d68b747279f86175f48fd
3
+ metadata.gz: e79dd86a282c324736e936292414708843017c6f
4
+ data.tar.gz: 7ec40540a6509d5991daaff80ff17870560459ee
5
5
  SHA512:
6
- metadata.gz: a98dccfbf117a51d37156630bb5346bdf79d302a2b7fbc43d3d0991ef8aa52709f0aea5470ecc41753212d58b7a07daac70c8fe034366033491eb77d04a65d93
7
- data.tar.gz: 2da0f6044560cc729c7466b0767d43e2cfbdee32fcdcbbc2f7d3cb725f0f6126d0b5c48483d657bebc240e811f26dc143bcdfb4e7673731b1adcf3b59320f022
6
+ metadata.gz: c522a8ba5de365cf09d3e64a88da531417c7c9be92de532909fd8ef4950cb8c1b519913065449ba5328852c4a108015b9fc966e31750b6ee7a7966d19de05934
7
+ data.tar.gz: 08e00ad01dd981ab8efc51ca60d2abd11b43554bb337c0c816762e99adfb4c93e7196a6846f6d52cfae16fa3143412eb47814569908e9c1950c02b6aee408fa9
data/GETTING_STARTED.md CHANGED
@@ -35,6 +35,14 @@ model :User, base: MyModel do
35
35
  end
36
36
  ```
37
37
 
38
+ You can specify base class for model builder using `builder_base` option:
39
+
40
+ ```ruby
41
+ model :User, builder_base: :CustomBuilder do
42
+
43
+ end
44
+ ```
45
+
38
46
  ## Enums
39
47
 
40
48
  Enum is describing in `enum` block:
@@ -162,7 +170,7 @@ Immutabler.group :TESalonModels do
162
170
  attr :Active
163
171
  end
164
172
 
165
- model :Salon, base: 'CustomModel' do
173
+ model :Salon, base: 'CustomModel', builder_base: 'CustomBuilder' do
166
174
  fields do
167
175
  prop :modelId, :int
168
176
  prop :address, :string
@@ -43,11 +43,12 @@ module Immutabler
43
43
  def model(name, options = {}, &block)
44
44
  prefix = @prefix + name.to_s
45
45
  base = options.fetch(:base, @base_model).to_s
46
+ builder_base = options.fetch(:builder_base, base).to_s
46
47
  props = []
47
48
  mappings = []
48
49
  ModelAttributesBuilder.new(props, mappings, &block)
49
50
 
50
- model = Model.new(prefix, base, props, mappings)
51
+ model = Model.new(prefix, base, builder_base, props, mappings)
51
52
 
52
53
  models << model
53
54
  end
@@ -1,11 +1,12 @@
1
1
  module Immutabler
2
2
  module DSL
3
3
  class Model
4
- attr_accessor :name, :base, :props, :mappings
4
+ attr_accessor :name, :base, :builder_base, :props, :mappings
5
5
 
6
- def initialize(name, base, props, mappings)
6
+ def initialize(name, base, builder_base, props, mappings)
7
7
  @name = name
8
8
  @base = base
9
+ @builder_base = builder_base
9
10
  @props = props
10
11
  @mappings = mappings
11
12
  end
@@ -21,6 +21,7 @@ module Immutabler
21
21
  {
22
22
  name: model.name,
23
23
  base_class: model.base,
24
+ builder_base_class: model.builder_base,
24
25
  props: build_props(model.props),
25
26
  any_mappings: model.mappings.any?,
26
27
  array_mappings: model.mappings.select(&:array?),
@@ -1,3 +1,3 @@
1
1
  module Immutabler
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -26,7 +26,7 @@
26
26
 
27
27
  {{/interface}}
28
28
 
29
- @interface {{name}}Builder : {{base_class}}
29
+ @interface {{name}}Builder : {{builder_base_class}}
30
30
 
31
31
  {{#declare_props props readOnly=false}}
32
32
  {{/declare_props}}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: immutabler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serhij Korochanskyj
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-09-22 00:00:00.000000000 Z
12
+ date: 2015-09-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: handlebars