cable_menu 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/cable_menu.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{cable_menu}
3
- s.version = "0.0.3"
3
+ s.version = "0.0.4"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Spencer Markowski | The Able Few"]
data/lib/cable_menu.rb CHANGED
@@ -1,3 +1,5 @@
1
1
  # CableMenu
2
+ require 'active_support/core_ext'
3
+
2
4
  require "cable_menu/acts_as_cable_menu"
3
5
  require "cable_menu/acts_as_cable"
@@ -1,21 +1,21 @@
1
+ require 'rails'
2
+
1
3
  module Cable
2
-
4
+ class Railtie < Rails::Railtie
5
+ config.to_prepare do
6
+ ActiveRecord::Base.send(:include, Cable::ActsAsCable)
7
+ end
8
+ end
9
+ end
10
+
11
+ module Cable::ActsAsCable
3
12
  def self.included( base )
4
13
  base.send :extend, ClassMethods
5
14
  end
6
15
 
7
16
  module ClassMethods
8
17
  def acts_as_cable( reflection_options = {} )
9
- send :include, InstanceMethods
10
18
  has_one :menu, reflection_options.merge( :as => :cable_menuable )
11
19
  end
12
20
  end
13
-
14
- module InstanceMethods
15
-
16
-
17
- end
18
-
19
- ActiveRecord::Base.send :include, Cable
20
-
21
- end
21
+ end
@@ -1,17 +1,28 @@
1
+ require 'rails'
2
+ require 'awesome_nested_set'
3
+
1
4
  module CableMenu
5
+ class Railtie < Rails::Railtie
6
+ config.to_prepare do
7
+ ActiveRecord::Base.send(:include, CableMenu::ActsAsCableMenu)
8
+ end
9
+ end
10
+ end
11
+
12
+ module CableMenu::ActsAsCableMenu
2
13
 
3
14
  def self.included( base )
4
15
  base.send :extend, ClassMethods
5
16
  end
6
17
 
7
18
  module ClassMethods
19
+
8
20
  def acts_as_cable_menu( reflection_options = {} )
9
21
  send :include, InstanceMethods
10
22
  belongs_to :cable_menuable, reflection_options.merge( :polymorphic => true )
11
23
  acts_as_nested_set
12
24
  end
13
25
  end
14
-
15
26
  module InstanceMethods
16
27
 
17
28
  def resource
@@ -24,6 +35,4 @@ module CableMenu
24
35
 
25
36
  end
26
37
 
27
- ActiveRecord::Base.send :include, CableMenu
28
-
29
38
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cable_menu
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 0
9
- - 3
10
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
11
10
  platform: ruby
12
11
  authors:
13
12
  - Spencer Markowski | The Able Few
@@ -39,7 +38,7 @@ files:
39
38
  - generators/cable_menu/templates/cable_menu_migration.rb
40
39
  - generators/cable_menu/templates/cable_model.rb
41
40
  - generators/cable_menu/USAGE
42
- has_rdoc: false
41
+ has_rdoc: true
43
42
  homepage: http://theablefew.com/
44
43
  licenses: []
45
44
 
@@ -53,7 +52,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
52
  requirements:
54
53
  - - ">="
55
54
  - !ruby/object:Gem::Version
56
- hash: 3
57
55
  segments:
58
56
  - 0
59
57
  version: "0"
@@ -62,7 +60,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
60
  requirements:
63
61
  - - ">="
64
62
  - !ruby/object:Gem::Version
65
- hash: 11
66
63
  segments:
67
64
  - 1
68
65
  - 2