Module: Rails::Generator::Options::ClassMethods
- Defined in:
- lib/rails_generator/options.rb
Instance Method Summary collapse
- #default_options(options = nil) ⇒ Object
-
#full_options(runtime_options = {}) ⇒ Object
Merge together our class options.
- #inherited_with_options(sub) ⇒ Object
- #mandatory_options(options = nil) ⇒ Object
Instance Method Details
#default_options(options = nil) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/rails_generator/options.rb', line 31 def ( = nil) if write_inheritable_attribute(:default_options, ) else read_inheritable_attribute(:default_options) or write_inheritable_attribute(:default_options, {}) end end |
#full_options(runtime_options = {}) ⇒ Object
Merge together our class options. In increasing precedence:
default_options (class default options)
runtime_options (provided as argument)
mandatory_options (class mandatory options)
43 44 45 |
# File 'lib/rails_generator/options.rb', line 43 def ( = {}) .merge().merge() end |
#inherited_with_options(sub) ⇒ Object
18 19 20 21 |
# File 'lib/rails_generator/options.rb', line 18 def (sub) (sub) if respond_to?(:inherited_without_options) sub.extend(Rails::Generator::Options::ClassMethods) end |
#mandatory_options(options = nil) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/rails_generator/options.rb', line 23 def ( = nil) if write_inheritable_attribute(:mandatory_options, ) else read_inheritable_attribute(:mandatory_options) or write_inheritable_attribute(:mandatory_options, {}) end end |