Module: TinyDyno::Fields
- Extended by:
- ActiveSupport::Concern
- Included in:
- DocumentComposition
- Defined in:
- lib/tiny_dyno/fields.rb,
lib/tiny_dyno/fields/standard.rb
Defined Under Namespace
Modules: ClassMethods Classes: Standard
Constant Summary collapse
- TYPE_MAPPINGS =
{ # binary_blob: 'B', # bool: Boolean, # binary_set: Array, list: Array, map: Hash, number: Integer, number_set: Array, # null: Null, string: String, string_set: Array, time: Time, }
- SUPPORTED_FIELD_TYPES =
[Array, Hash, Integer, Array, String, Time].freeze
Class Method Summary collapse
-
.option(option_name, &block) ⇒ Object
Stores the provided block to be run when the option name specified is defined on a field.
-
.options ⇒ Hash
Return a map of custom option names to their handlers.
Instance Method Summary collapse
-
#database_field_name(name) ⇒ String
Get the name of the provided field as it is stored in the database.
Class Method Details
.option(option_name, &block) ⇒ Object
Stores the provided block to be run when the option name specified is defined on a field.
No assumptions are made about what sort of work the handler might perform, so it will always be called if the option_name key is provided in the field definition – even if it is false or nil.
50 51 52 |
# File 'lib/tiny_dyno/fields.rb', line 50 def option(option_name, &block) [option_name] = block end |
.options ⇒ Hash
Return a map of custom option names to their handlers.
63 64 65 |
# File 'lib/tiny_dyno/fields.rb', line 63 def @options ||= {} end |
Instance Method Details
#database_field_name(name) ⇒ String
Get the name of the provided field as it is stored in the database. Used in determining if the field is aliased or not.
79 80 81 |
# File 'lib/tiny_dyno/fields.rb', line 79 def database_field_name(name) self.class.database_field_name(name) end |