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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODRhY2Q0ZDUxY2JkMmJkOWNhNjYzNWM1ZmMyYTg5NTRmNGMxZGFhYg==
4
+ ZGU5YThlZWE2OWI2ZmVjY2VkN2Q3YTkzMDc0MGM3ODFlYmMyMDg1Zg==
5
5
  data.tar.gz: !binary |-
6
- NTk5NGQ0NDViZjQ3YTI1YTM3MGZjZjhjMzdmNzRiMjQ1YmVjNjcwZg==
6
+ OTc0OGZlNWIxMmE3MDcyMGFmYjc0Y2Q3MTNlMmYyYmJlZGJiZjYwOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MmVmY2VjYTgxZWFhMTY2ODA3ZWUzN2JmNWE1MjUwOGUyZDM0ZmU5MTNhMDJm
10
- ODdiZGJhMzg5NDM3ZDQwZTY2OTRiYzRhOTU1N2UxYTA0Zjk1MTVkZTU2ZTYy
11
- MTMwOWYyMmJmYjY3OTBmMjc1NTg5ZDhkMjhkNmFmZTc1MzVlODQ=
9
+ MWFjYTI1MWVhYmZkYWQ4ZmE3MTJiY2FmZjY1MzA3MWEzNDg0Njg0ZGM0ZTE3
10
+ NzQyMjM0MjAwMmI1YzgwZWUyN2Y1N2E5ZWZkZjkwMzA2ODYzZTU2ZWRkYWQw
11
+ NDJjN2NhYzY4MDVlMThkNWYwMTBiMzY2YjRiNGYwMGIwY2YxNDE=
12
12
  data.tar.gz: !binary |-
13
- OWYyZTJlYTYxNGU3Mjg4MTkyZWVlZmY3YzdiNGE2MDIyZDA0MjI0NzhlNzRh
14
- ODY1NmQ3OTQyODY4YzM0M2Q2M2Q2NDNmOGVmYjAzNTgxNjcyYTQ2NTJhMjFh
15
- ZDcxYTI0NzBkNzgyNTRjN2ZjYzZlOGM1NWQ3ZjY4YmNkMzRkMTk=
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
@@ -0,0 +1,15 @@
1
+ class RKit::Decorator::Base < SimpleDelegator
2
+ def initialize base, view_context
3
+ @view_context = view_context
4
+
5
+ super(base)
6
+ end
7
+
8
+ def _h
9
+ @view_context
10
+ end
11
+
12
+ def === object
13
+ self == object || __getobj__ == object
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module RKit::Decorator
2
+ ActiveRecord::Base.extend ActiveRecordExtension
3
+ end
data/lib/r_kit/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RKit
2
- VERSION = "0.1.2.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/r_kit.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require "r_kit/version"
2
2
  require "r_kit/engine"
3
3
 
4
- require "r_kit/decorable"
4
+ require "r_kit/decorator"
5
5
 
6
6
  module RKit
7
7
  # Your code goes here...
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.2.2
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: 2013-11-14 00:00:00.000000000 Z
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/decorable.rb
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.6
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'
@@ -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