r_kit 0.5 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/r_kit/active_record_utility/active_record_extend.rb +28 -12
- data/lib/r_kit/active_record_utility/utilities/series.rb +115 -77
- data/lib/r_kit/active_record_utility/utilities/tag.rb +6 -2
- data/lib/r_kit/active_record_utility.rb +2 -0
- data/lib/r_kit/core/loader.rb +1 -1
- data/lib/r_kit/css/lib/assets/stylesheets/r_kit/base/typography/hr.scss +5 -0
- data/lib/r_kit/css/lib/assets/stylesheets/r_kit/base/typography/links.scss +2 -0
- data/lib/r_kit/css/lib/assets/stylesheets/r_kit/base/typography/paragraphs.scss +3 -1
- data/lib/r_kit/css/lib/assets/stylesheets/r_kit/base/typography/titles.scss +4 -2
- data/lib/r_kit/css/lib/assets/stylesheets/r_kit/base/typography.scss +1 -0
- data/lib/r_kit/css/lib/assets/stylesheets/r_kit/components/btn.scss +3 -0
- data/lib/r_kit/css/lib/assets/stylesheets/r_kit/mixins/alignments.scss +7 -0
- data/lib/r_kit/css/lib/assets/stylesheets/r_kit/mixins/blocks.scss +4 -0
- data/lib/r_kit/css/lib/assets/stylesheets/r_kit/mixins/box-shadows/curved-shadows.scss +1 -1
- data/lib/r_kit/css/lib/assets/stylesheets/r_kit/mixins/box-shadows/straight-shadows.scss +1 -1
- data/lib/r_kit/css/lib/assets/stylesheets/r_kit/mixins/links.scss +12 -0
- data/lib/r_kit/css/lib/assets/stylesheets/r_kit/mixins/titles.scss +6 -10
- data/lib/r_kit/css/lib/assets/stylesheets/r_kit/mixins.scss +2 -0
- data/lib/r_kit/css/lib/assets/stylesheets/r_kit/variables/colors.scss +1 -1
- data/lib/r_kit/css/sass_extend.rb +1 -2
- data/lib/r_kit/css.rb +13 -11
- data/lib/r_kit/decoration/action_view_base_extend.rb +1 -2
- data/lib/r_kit/decoration/base/collection.rb +11 -11
- data/lib/r_kit/decoration/base/object.rb +0 -18
- data/lib/r_kit/decoration/base.rb +39 -2
- data/lib/r_kit/decoration/class.rb +26 -55
- data/lib/r_kit/decoration/dsl.rb +14 -83
- data/lib/r_kit/decoration/enumerable_extend.rb +5 -1
- data/lib/r_kit/decoration/object_extend.rb +5 -0
- data/lib/r_kit/decoration.rb +4 -7
- data/lib/r_kit/dsl/base/thrust.rb +6 -2
- data/lib/r_kit/dsl/base.rb +9 -3
- data/lib/r_kit/dsl/dsl_extend.rb +1 -1
- data/lib/r_kit/dsl/test.rb +81 -0
- data/lib/r_kit/dsl.rb +1 -6
- data/lib/r_kit/frame/collection_dsl.rb +24 -0
- data/lib/r_kit/frame/empty_frame.rb +7 -0
- data/lib/r_kit/frame/instance_dsl.rb +30 -0
- data/lib/r_kit/frame.rb +14 -0
- data/lib/r_kit/grid/base/grid.rb +69 -19
- data/lib/r_kit/grid/base/grid_col.rb +22 -19
- data/lib/r_kit/grid/base.rb +1 -15
- data/lib/r_kit/grid/binding.rb +3 -10
- data/lib/r_kit/grid/lib/assets/stylesheets/r_kit/base/grid.scss +15 -18
- data/lib/r_kit/grid/lib/assets/stylesheets/r_kit/base/grid_flex.scss +19 -0
- data/lib/r_kit/grid/lib/assets/stylesheets/r_kit/base/grid_items.scss +5 -0
- data/lib/r_kit/grid/lib/assets/stylesheets/r_kit/grid.scss +2 -0
- data/lib/r_kit/grid/lib/assets/stylesheets/r_kit/mixins/{gris.scss → grid.scss} +0 -0
- data/lib/r_kit/grid.rb +2 -3
- data/lib/r_kit/override/base.rb +125 -0
- data/lib/r_kit/override/method_extend.rb +8 -0
- data/lib/r_kit/override/module_extend.rb +53 -0
- data/lib/r_kit/override/pattern.rb +53 -0
- data/lib/r_kit/override/perfs.rb +117 -0
- data/lib/r_kit/override/test.rb +466 -0
- data/lib/r_kit/override/unbound_method_extend.rb +8 -0
- data/lib/r_kit/override.rb +15 -0
- data/lib/r_kit/pagination/base/page.rb +5 -23
- data/lib/r_kit/pagination/base.rb +32 -62
- data/lib/r_kit/pagination/dsl.rb +10 -0
- data/lib/r_kit/pagination/enumerable_extend.rb +7 -0
- data/lib/r_kit/pagination.rb +29 -2
- data/lib/r_kit/parser/base.rb +19 -0
- data/lib/r_kit/parser/leaf.rb +72 -0
- data/lib/r_kit/parser/test.rb +76 -0
- data/lib/r_kit/parser/tree.rb +22 -0
- data/lib/r_kit/parser.rb +8 -0
- data/lib/r_kit/struct/collection_delegator.rb +0 -6
- data/lib/r_kit/utility/basic_object_extend.rb +9 -0
- data/lib/r_kit/utility/kernel_extend.rb +9 -3
- data/lib/r_kit/utility/main_extend.rb +22 -0
- data/lib/r_kit/utility/module_extend.rb +18 -11
- data/lib/r_kit/utility/simple_delegator_extend.rb +1 -1
- data/lib/r_kit/utility/symbol_extend.rb +1 -1
- data/lib/r_kit/utility.rb +4 -2
- data/lib/r_kit/version.rb +1 -1
- metadata +29 -5
- data/lib/r_kit/grid/base/grid_row.rb +0 -29
- data/lib/r_kit/grid/kernel_extend.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdb67eccab0559337e3ceb3ffac44abe7a5a0eb7
|
4
|
+
data.tar.gz: 97dbedfa706dcd908c2afa34a480c7fe3ea8cf0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb8202557efbd77f2bbc38c993f5d3a0391bd8bb94272e2d078dedee01eb6b566c1a87a010bc2b27989372cad25c00b147754a3f2c540dda077fffd5407b8ef6
|
7
|
+
data.tar.gz: 55be195d767611126530b158969e4b7e151718e17d91c582d746048c70528863c78b2c3662904598df6927412c696a881290a5dfefdcd85f05bd7794a50730fd
|
@@ -1,20 +1,36 @@
|
|
1
|
-
|
1
|
+
class ActiveRecord::Base
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
override_singleton_method :scope do |name, body, &block|
|
4
|
+
__olddef__(name, body, &block).tap do |scope_name|
|
5
|
+
|
6
|
+
override_singleton_method scope_name do |*args, &block|
|
7
|
+
__olddef__(*args, &block).tap do |collection|
|
8
|
+
collection.scopes << scope_name
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
8
13
|
end
|
9
14
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
find_by id: options[:id]
|
15
|
+
|
16
|
+
depend on: :frame do
|
17
|
+
def scoped? *args
|
18
|
+
frame.scoped? *args
|
15
19
|
end
|
16
20
|
end
|
17
21
|
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
class ActiveRecord::Relation
|
26
|
+
|
27
|
+
attr_reader :scopes, default: proc{ [] }
|
28
|
+
|
29
|
+
def scoped? name
|
30
|
+
scopes.include? name
|
31
|
+
end
|
32
|
+
|
33
|
+
RKit::Frame::CollectionDsl.domain self
|
34
|
+
acts_as_frameable_collection
|
18
35
|
|
19
|
-
ActiveRecord::Base.extend self
|
20
36
|
end
|
@@ -16,9 +16,8 @@ class RKit::ActiveRecordUtility::Series
|
|
16
16
|
|
17
17
|
allowed? do
|
18
18
|
table_exists? &&
|
19
|
-
column_names.
|
20
|
-
columns_hash["following_id"].type == :integer
|
21
|
-
columns_hash["series"].type == :string
|
19
|
+
column_names.include?("following_id") &&
|
20
|
+
columns_hash["following_id"].type == :integer
|
22
21
|
end
|
23
22
|
|
24
23
|
restricted do
|
@@ -31,10 +30,10 @@ class RKit::ActiveRecordUtility::Series
|
|
31
30
|
has_one :followed, class_name: name, foreign_key: "following_id"
|
32
31
|
belongs_to :following, class_name: name
|
33
32
|
|
34
|
-
before_validation if: :following_id_changed? do
|
35
|
-
self.title ||= following.title if __class__.column_exists? "title"
|
36
|
-
self.series = following.series.name
|
37
|
-
end
|
33
|
+
# before_validation if: :following_id_changed? do
|
34
|
+
# self.title ||= following.title if __class__.column_exists? "title"
|
35
|
+
# self.series = following.series.name
|
36
|
+
# end
|
38
37
|
|
39
38
|
|
40
39
|
|
@@ -47,15 +46,11 @@ class RKit::ActiveRecordUtility::Series
|
|
47
46
|
|
48
47
|
# TODO: validates a record can only have one follower (or is it hadled by the "has_one" relation directly ?)
|
49
48
|
|
50
|
-
validates_presence_of :series, if: :following
|
49
|
+
# validates_presence_of :series, if: :following
|
51
50
|
validates_uniqueness_of :following_id, if: :following
|
52
51
|
|
53
|
-
scope :series, ->(series){ series && where(series: series) }
|
54
|
-
|
55
|
-
# TODO: adapter le scope pour intégrer les published (si interfered)
|
56
|
-
# je laisse en commentaire parceque j'aime pas le nom du scope,
|
57
|
-
# et j'ai pas d'idée là maintenant (à part 'pilotes', ou 'firsts')
|
58
|
-
# scope :firsts_of_series, ->{ where(following_id: nil) }
|
52
|
+
# scope :series, ->(series){ series && where(series: series) }
|
53
|
+
scope :firsts_of_series, ->{ where(following_id: nil) }
|
59
54
|
|
60
55
|
# TODO: scope pour l'ordre dans une serie (pour le decorator pagination_tag)
|
61
56
|
|
@@ -64,21 +59,37 @@ class RKit::ActiveRecordUtility::Series
|
|
64
59
|
|
65
60
|
|
66
61
|
methods :instance do
|
62
|
+
def first_of_serie
|
63
|
+
following ? following.send(__method__) : self
|
64
|
+
end
|
65
|
+
|
67
66
|
def series
|
68
|
-
|
69
|
-
# @@_active_record_utilities_series[read_attribute(:series)] ||= series_struct if read_attribute(:series)
|
70
|
-
# TODO: if series changes, or new element added, series must be re-calculated
|
71
|
-
# maybe pre-calc this in after save
|
67
|
+
first_of_serie.nexts_of_serie if in_a_series?
|
72
68
|
end
|
73
69
|
|
74
|
-
def
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
70
|
+
def in_a_series?
|
71
|
+
following || followed
|
72
|
+
end
|
73
|
+
|
74
|
+
def nexts_of_serie
|
75
|
+
followed ? [self] + followed.send(__method__) : [self]
|
80
76
|
end
|
81
77
|
|
78
|
+
# def series
|
79
|
+
# series_struct if read_attribute(:series)
|
80
|
+
# # @@_active_record_utilities_series[read_attribute(:series)] ||= series_struct if read_attribute(:series)
|
81
|
+
# # TODO: if series changes, or new element added, series must be re-calculated
|
82
|
+
# # maybe pre-calc this in after save
|
83
|
+
# end
|
84
|
+
#
|
85
|
+
# def series_struct
|
86
|
+
# OpenStruct.new.tap do |series_struct|
|
87
|
+
# series_struct.name = read_attribute :series
|
88
|
+
# series_struct.collection = __class__.series series_struct.name
|
89
|
+
# series_struct.size = series_struct.collection.count
|
90
|
+
# end
|
91
|
+
# end
|
92
|
+
|
82
93
|
def position_in_series
|
83
94
|
following ? following.send(__method__) + 1 : 1
|
84
95
|
end
|
@@ -86,77 +97,104 @@ class RKit::ActiveRecordUtility::Series
|
|
86
97
|
|
87
98
|
|
88
99
|
methods :decorator do
|
89
|
-
after_initialize do
|
100
|
+
#after_initialize do
|
90
101
|
# TODO: this can't stay this way, if "serie" is pre-calculated
|
91
102
|
# & shared accros instances & kept in memory (class variable)
|
92
103
|
|
93
104
|
# series.collection = series.collection.decorate if series
|
94
105
|
# TODO: infinite loop, need a "unless" on the after_init, or smthng even more smart
|
95
106
|
# ps: i'm not happy with this current decorate
|
96
|
-
end
|
107
|
+
#end
|
97
108
|
|
98
|
-
|
99
|
-
|
100
|
-
|
109
|
+
# depend on: :series do
|
110
|
+
# def series_url
|
111
|
+
# view.url_for [__class__, series: series.name]
|
112
|
+
# end
|
113
|
+
#
|
114
|
+
# def link_to_series
|
115
|
+
# view.link_to series.name, series_url, class: :btn
|
116
|
+
# end
|
117
|
+
# end
|
101
118
|
|
102
|
-
def link_to_series
|
103
|
-
view.link_to series.name, series_url, class: :btn
|
104
|
-
end
|
105
119
|
|
106
120
|
if decorated_class.columns_hash["title"]
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
def title options = {}
|
118
|
-
if series and false # and showcase
|
119
|
-
showcase_title
|
120
|
-
elsif series
|
121
|
-
series_title
|
122
|
-
else
|
123
|
-
super()
|
121
|
+
depend on: :series, strict: false do
|
122
|
+
|
123
|
+
# TODO: I don't get this "showcase thing", we can delete that and just look into the view for the params
|
124
|
+
# Or in the collection, to see if the scope is applied (second solution is better)
|
125
|
+
# TODO: to make a decision, we need to know if 'first_of_Series' scope is applied
|
126
|
+
# for that, we need to add behavior to 'scope' (ActiveRecord::Scoping::Named::ClassMethods)
|
127
|
+
# and, on an instance, to keep the 'collection where it come from' intel (?? ennumerable first, etc ??)
|
128
|
+
def series_title
|
129
|
+
"#{ __getobj__.title } <small><i class='no-warp'>(vol #{ position_in_series })</i></small>".html_safe
|
124
130
|
end
|
125
|
-
end
|
126
|
-
end
|
127
131
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
# in fact, the collection does not use the "self" object, so the singleton_class is lost
|
132
|
-
def pagination_tag
|
133
|
-
disable_pagination_link self
|
134
|
-
series.collection.decorate.map(&:pagination_link_to).reduce(:safe_concat)
|
135
|
-
end
|
132
|
+
def showcase_title
|
133
|
+
"#{ __getobj__.title } <small><i class='no-warp'>(#{ series.size } vols)</i></small>".html_safe
|
134
|
+
end
|
136
135
|
|
137
|
-
|
138
|
-
|
139
|
-
|
136
|
+
# TODO: title don't work if there is no series
|
137
|
+
# cause 'depend' stille define the method, but will return nil
|
138
|
+
def title options = {}
|
139
|
+
if showcase
|
140
|
+
showcase_title
|
141
|
+
else
|
142
|
+
series_title
|
143
|
+
end
|
144
|
+
end
|
140
145
|
|
141
|
-
|
142
|
-
|
143
|
-
|
146
|
+
# TODO: don't ssems to work in decorated obj
|
147
|
+
def showcase
|
148
|
+
scoped? :firsts_of_series
|
149
|
+
# collection_context.then{ |collection| collection.scoped? :firsts_of_series }
|
150
|
+
end
|
144
151
|
|
145
|
-
def disable_pagination_link seriable_instance
|
146
|
-
class << seriable_instance
|
147
|
-
alias :pagination_link_to :disabled_pagination_link_to
|
148
152
|
end
|
149
153
|
end
|
150
154
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
155
|
+
depend on: :series do
|
156
|
+
|
157
|
+
# # TODO: put default locales keys ("vol" is hard coded here) in cluster
|
158
|
+
# # same for the 'title' methods before
|
159
|
+
# # TODO: the "disabled" link for self doesn't work yet
|
160
|
+
# # in fact, the collection does not use the "self" object, so the singleton_class is lost
|
161
|
+
# def pagination_tag
|
162
|
+
# series.collection.decorate.map{ |x|
|
163
|
+
# if x === self
|
164
|
+
# x.disabled_pagination_link_to
|
165
|
+
# else
|
166
|
+
# x.pagination_link_to
|
167
|
+
# end
|
168
|
+
# }.reduce(:safe_concat)
|
169
|
+
# end
|
170
|
+
#
|
171
|
+
# def pagination_link_to
|
172
|
+
# view.link_to "vol #{ position_in_series }", self, class: :btn
|
173
|
+
# end
|
174
|
+
#
|
175
|
+
# def disabled_pagination_link_to
|
176
|
+
# view.content_tag :span, "vol #{ position_in_series }", class: :'btn-disabled'
|
177
|
+
# end
|
178
|
+
|
179
|
+
|
180
|
+
def navigation_tag
|
181
|
+
view.content_tag :p do
|
182
|
+
safe_buffer = ActiveSupport::SafeBuffer.new
|
183
|
+
|
184
|
+
if following
|
185
|
+
safe_buffer += view.link_to(following, class: :btn){ view.fa_icon('angle-left') + " Previous" }
|
186
|
+
end
|
187
|
+
|
188
|
+
if following && followed
|
189
|
+
safe_buffer += " "
|
190
|
+
end
|
191
|
+
|
192
|
+
if followed
|
193
|
+
safe_buffer += view.link_to(followed, class: :btn){ "Next ".html_safe + view.fa_icon('angle-right') }
|
194
|
+
end
|
195
|
+
|
196
|
+
safe_buffer
|
197
|
+
end
|
160
198
|
end
|
161
199
|
end
|
162
200
|
end
|
@@ -20,11 +20,15 @@ class RKit::ActiveRecordUtility::Tag
|
|
20
20
|
validates_presence_of :tag
|
21
21
|
validates_uniqueness_of :tag
|
22
22
|
|
23
|
-
def tagged(tag) find_by tag: tag end
|
23
|
+
def tagged(tag) find_by tag: tag.underscore end
|
24
24
|
end
|
25
25
|
|
26
26
|
methods :instance do
|
27
|
-
def to_param() tag end
|
27
|
+
def to_param() tag.dasherize end
|
28
|
+
end
|
29
|
+
|
30
|
+
methods :decorator do
|
31
|
+
delegate :to_param, to: :__getobj__
|
28
32
|
end
|
29
33
|
|
30
34
|
end
|
data/lib/r_kit/core/loader.rb
CHANGED
@@ -3,3 +3,15 @@
|
|
3
3
|
text-decoration: inherit;
|
4
4
|
cursor: inherit;
|
5
5
|
}
|
6
|
+
|
7
|
+
@mixin highlighted-link() {
|
8
|
+
|
9
|
+
@include highlighted-block;
|
10
|
+
|
11
|
+
&:hover{
|
12
|
+
color: rgba(white-color(), .85);
|
13
|
+
background-color: rgba(black-color(), .80);
|
14
|
+
|
15
|
+
text-decoration: inherit;
|
16
|
+
}
|
17
|
+
}
|
@@ -1,18 +1,14 @@
|
|
1
|
-
@mixin link-
|
1
|
+
@mixin link-title() {
|
2
2
|
a{
|
3
3
|
@include unstyled-link();
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
}
|
10
|
-
}
|
5
|
+
display: block;
|
6
|
+
|
7
|
+
margin: -1em 0;
|
8
|
+
padding: 1em 0;
|
11
9
|
|
12
|
-
@mixin link-unstyled-title() {
|
13
|
-
a{
|
14
10
|
&:hover{
|
15
|
-
|
11
|
+
text-decoration: none;
|
16
12
|
}
|
17
13
|
}
|
18
14
|
}
|
data/lib/r_kit/css.rb
CHANGED
@@ -8,18 +8,20 @@ class RKit::Css
|
|
8
8
|
config :colors, :grey, '#888'
|
9
9
|
config :colors, :light_black, '#181818'
|
10
10
|
config :colors, :red, '#b62b2b'
|
11
|
+
config :colors, :goldenrod, '#daa520'
|
11
12
|
config :colors, :white, '#fbfbfb'
|
12
13
|
|
13
|
-
alias_config :colors, :
|
14
|
-
alias_config :colors, :
|
15
|
-
alias_config :colors, :
|
16
|
-
alias_config :colors, :
|
17
|
-
alias_config :colors, :
|
14
|
+
alias_config :colors, :primary, :red
|
15
|
+
alias_config :colors, :link, :goldenrod
|
16
|
+
alias_config :colors, :text, :grey
|
17
|
+
alias_config :colors, :text_alt, :dark_black
|
18
|
+
alias_config :colors, :background, :black
|
19
|
+
alias_config :colors, :background_alt, :light_black
|
18
20
|
|
19
|
-
alias_config :colors, :
|
20
|
-
alias_config :colors, :
|
21
|
-
alias_config :colors, :
|
22
|
-
alias_config :colors, :
|
21
|
+
alias_config :colors, :btn, :background
|
22
|
+
alias_config :colors, :btn_background, :primary
|
23
|
+
alias_config :colors, :btn_disabled, :text_alt
|
24
|
+
alias_config :colors, :btn_disabled_background, :background_alt
|
23
25
|
|
24
26
|
|
25
27
|
# unused colors
|
@@ -28,8 +30,8 @@ class RKit::Css
|
|
28
30
|
|
29
31
|
preset :light_colors,
|
30
32
|
colors: {
|
31
|
-
|
32
|
-
|
33
|
+
text: '#444',
|
34
|
+
background: '#f9f9f9'
|
33
35
|
|
34
36
|
# $background-alt-color: #e6e6e6;
|
35
37
|
# border color #eee
|
@@ -1,20 +1,20 @@
|
|
1
1
|
class RKit::Decoration::Collection < CollectionDelegator
|
2
2
|
include RKit::Decoration::Base
|
3
3
|
|
4
|
+
def initialize *args
|
5
|
+
super
|
4
6
|
|
5
|
-
|
7
|
+
self.singleton_class.send :override_method, :each do |&block|
|
8
|
+
__olddef__ do |object|
|
9
|
+
if object.need_decoration?
|
10
|
+
block.call object.decorate(view_context: view)
|
11
|
+
else
|
12
|
+
block.call object
|
13
|
+
end
|
6
14
|
|
7
|
-
def safe() tap{ @safe_mode = true } end
|
8
|
-
def unsafe() tap{ @safe_mode = false } end
|
9
|
-
|
10
|
-
|
11
|
-
def each &block
|
12
|
-
collection.each do |object|
|
13
|
-
if safe_mode && object.dont_respond_to?(:decorate)
|
14
|
-
block.call object
|
15
|
-
else
|
16
|
-
block.call object.decorate(view_context: view)
|
17
15
|
end
|
18
16
|
end
|
17
|
+
|
18
|
+
self.extend Enumerable
|
19
19
|
end
|
20
20
|
end
|
@@ -1,21 +1,3 @@
|
|
1
1
|
class RKit::Decoration::Object < SimpleDelegator
|
2
2
|
include RKit::Decoration::Base
|
3
|
-
|
4
|
-
|
5
|
-
singleton_attr_reader :decorated_class
|
6
|
-
singleton_attr_reader :after_initialize_procs, default: proc{ [] }
|
7
|
-
|
8
|
-
def self.after_initialize &block
|
9
|
-
after_initialize_procs << block
|
10
|
-
end
|
11
|
-
|
12
|
-
def after_initialize!
|
13
|
-
decorator_class.after_initialize_procs.each{ |after_initialize_proc| self.instance_eval &after_initialize_proc }
|
14
|
-
end
|
15
|
-
|
16
|
-
|
17
|
-
def initialize obj, view_context: nil
|
18
|
-
super
|
19
|
-
after_initialize!
|
20
|
-
end
|
21
3
|
end
|