Class: Walruz::Config
- Inherits:
-
Object
- Object
- Walruz::Config
- Defined in:
- lib/walruz/config.rb
Instance Method Summary collapse
-
#actors=(actors) ⇒ Object
Given a list of classes, it will include the Actor module in each of them.
-
#enable_array_extension ⇒ Object
Will include the Walruz:CoreExt:Array module to the Array class.
- #enable_will_paginate_extension(options = {}) ⇒ Object
-
#subjects=(subjects) ⇒ Object
Given a list of classes, it will include the Subject module in each of them.
Instance Method Details
#actors=(actors) ⇒ Object
Given a list of classes, it will include the Actor module in each of them.
system
10 11 12 13 14 |
# File 'lib/walruz/config.rb', line 10 def actors=(actors) Array(actors).each do |actor| actor.send(:include, Actor) end end |
#enable_array_extension ⇒ Object
Will include the Walruz:CoreExt:Array module to the Array class
52 53 54 55 56 57 |
# File 'lib/walruz/config.rb', line 52 def enable_array_extension require File.( File.join(File.dirname(__FILE__), 'core_ext', 'array') ) safe_include(Array, Walruz::CoreExt::Array) end |
#enable_will_paginate_extension(options = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/walruz/config.rb', line 27 def enable_will_paginate_extension( = {}) = { :include_rails => false }.merge!() gem 'will_paginate' require File.( File.join(File.dirname(__FILE__), 'more', 'pagination') ) safe_include(WillPaginate::Collection, Walruz::More::Pagination::WillPaginateCollection) safe_include(Array, Walruz::More::Pagination::Base) if [:include_rails] raise LoadError.new("You ask to enable Walruz extensions on \ ActiveRecord::Base, but it was not found. Maybe you should require \ 'active_record' first?") unless defined?("ActiveRecord::Base") safe_include(::ActiveRecord::Base, Walruz::More::Pagination::Base) end rescue Gem::LoadError raise LoadError.new("You ask to enable Walruz extensions on \ WillPaginate, but it was not found, Maybe you should \ require 'will_paginate' first") end |
#subjects=(subjects) ⇒ Object
Given a list of classes, it will include the Subject module in each of them.
system
21 22 23 24 25 |
# File 'lib/walruz/config.rb', line 21 def subjects=(subjects) Array(subjects).each do |subject| subject.send(:include, Subject) end end |