r_kit 0.1.2.2 → 0.1.3
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 +8 -8
- data/lib/r_kit/decorator/active_record_extension.rb +25 -0
- data/lib/r_kit/decorator/base.rb +15 -0
- data/lib/r_kit/decorator.rb +3 -0
- data/lib/r_kit/version.rb +1 -1
- data/lib/r_kit.rb +1 -1
- metadata +6 -4
- data/lib/r_kit/decorable.rb +0 -26
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZGU5YThlZWE2OWI2ZmVjY2VkN2Q3YTkzMDc0MGM3ODFlYmMyMDg1Zg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTc0OGZlNWIxMmE3MDcyMGFmYjc0Y2Q3MTNlMmYyYmJlZGJiZjYwOA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MWFjYTI1MWVhYmZkYWQ4ZmE3MTJiY2FmZjY1MzA3MWEzNDg0Njg0ZGM0ZTE3
|
10
|
+
NzQyMjM0MjAwMmI1YzgwZWUyN2Y1N2E5ZWZkZjkwMzA2ODYzZTU2ZWRkYWQw
|
11
|
+
NDJjN2NhYzY4MDVlMThkNWYwMTBiMzY2YjRiNGYwMGIwY2YxNDE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTc4OWU5NDNmYjFiZTIxODc4MzViNGQ3YjQ5MmZiMzNmYjMyNWZmY2MxY2Q4
|
14
|
+
OWZjNWI0ZjlmZTU2Yzc2YjZiOTUxZTJjYWJjZjgwMDhhODBkNWFmNjZjMzg3
|
15
|
+
ZTRjZTUxYjY1YzIyNWZiYzVhYWM1MTBlMjNhNzAyZWU5Njg3NjQ=
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module RKit::Decorator::ActiveRecordExtension
|
2
|
+
def acts_as_decorables const = nil, &block
|
3
|
+
if block_given?
|
4
|
+
namespace = name.deconstantize.constantize
|
5
|
+
namespace.const_set "#{ name.demodulize }Decorator", Class.new(Decorator::Base, &block)
|
6
|
+
end
|
7
|
+
|
8
|
+
@const = const || "#{ name }Decorator".constantize
|
9
|
+
|
10
|
+
extend ClassMethods
|
11
|
+
include InstanceMethods
|
12
|
+
end
|
13
|
+
|
14
|
+
module ClassMethods
|
15
|
+
def decorator_class
|
16
|
+
@const
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
module InstanceMethods
|
21
|
+
def decorate view_context
|
22
|
+
self.class.decorator_class.new self, view_context
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/r_kit/version.rb
CHANGED
data/lib/r_kit.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Petrachi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Library for rails projects
|
14
14
|
email:
|
@@ -48,7 +48,9 @@ files:
|
|
48
48
|
- lib/assets/stylesheets/r_kit/variables/colors.scss
|
49
49
|
- lib/assets/stylesheets/r_kit/variables/typography.scss
|
50
50
|
- lib/r_kit.rb
|
51
|
-
- lib/r_kit/
|
51
|
+
- lib/r_kit/decorator.rb
|
52
|
+
- lib/r_kit/decorator/active_record_extension.rb
|
53
|
+
- lib/r_kit/decorator/base.rb
|
52
54
|
- lib/r_kit/engine.rb
|
53
55
|
- lib/r_kit/version.rb
|
54
56
|
- r_kit.gemspec
|
@@ -72,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
74
|
version: '0'
|
73
75
|
requirements: []
|
74
76
|
rubyforge_project:
|
75
|
-
rubygems_version: 2.1.
|
77
|
+
rubygems_version: 2.1.11
|
76
78
|
signing_key:
|
77
79
|
specification_version: 4
|
78
80
|
summary: ! 'Code library for rails : ruby core extend / rails helpers / css / js'
|
data/lib/r_kit/decorable.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
module RKit
|
2
|
-
module Decorable
|
3
|
-
def decorate(view_context)
|
4
|
-
@view_context = view_context
|
5
|
-
|
6
|
-
class << self
|
7
|
-
include DecoratorMethods
|
8
|
-
end
|
9
|
-
|
10
|
-
self
|
11
|
-
end
|
12
|
-
|
13
|
-
def h
|
14
|
-
@view_context
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
module DecorableHelper
|
19
|
-
def decorate obj, &block
|
20
|
-
capture do
|
21
|
-
block.call obj.decorate(self)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|