Module: IncludableWithOptions
- Defined in:
- lib/dolzenko/includable_with_options.rb
Overview
Check Thomas Sawyer take on the problem github.com/rubyworks/paramix
Class Attribute Summary collapse
-
.last_default_options ⇒ Object
Returns the value of attribute last_default_options.
Class Method Summary collapse
Class Attribute Details
.last_default_options ⇒ Object
Returns the value of attribute last_default_options.
4 5 6 |
# File 'lib/dolzenko/includable_with_options.rb', line 4 def end |
Class Method Details
.included(includable_with_options) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/dolzenko/includable_with_options.rb', line 7 def self.included() %w(string/methodize kernel/constant module/basename module/spacename).each { |facets_core_ext| require "facets/#{ facets_core_ext }" } raise "IncludableWithOptions should be included by the Module" unless .instance_of?(Module) = "@@#{ includable_with_options.basename.methodize }_options" unless IncludableWithOptions..nil? .send(:class_variable_set, , IncludableWithOptions.) IncludableWithOptions. = nil end context = Kernel.constant(.spacename) option_setting_duplicator = " def \#{ context != Kernel ? \"self.\" : \"\" }\#{ includable_with_options.basename }(options = nil)\n m = Kernel.constant(\"\#{ includable_with_options.name }\").dup\n m.send(:class_variable_set, \"\#{ options_class_var_name }\", options)\n m\n end \n CODE\n\n context.module_eval(option_setting_duplicator)\nend\n" |