Module: Virtus::Options
Overview
A module that adds class and instance level options
Instance Method Summary collapse
-
#accept_options(*new_options) ⇒ Array
Defines which options are valid for a given attribute class.
-
#accepted_options ⇒ Array
Returns an array of valid options.
-
#options ⇒ Hash
Returns default options hash for a given attribute class.
Instance Method Details
#accept_options(*new_options) ⇒ Array
Defines which options are valid for a given attribute class
50 51 52 53 54 55 |
# File 'lib/virtus/support/options.rb', line 50 def (*) () .each { |option| define_option_method(option) } descendants.each { |descendant| descendant.() } self end |
#accepted_options ⇒ Array
Returns an array of valid options
35 36 37 |
# File 'lib/virtus/support/options.rb', line 35 def @accepted_options ||= [] end |
#options ⇒ Hash
Returns default options hash for a given attribute class
16 17 18 19 20 21 22 23 |
# File 'lib/virtus/support/options.rb', line 16 def = {} .each do |option_name| option_value = send(option_name) [option_name] = option_value unless option_value.nil? end end |