Module: ActiveInteraction
- Defined in:
- lib/active_interaction.rb,
lib/active_interaction/base.rb,
lib/active_interaction/input.rb,
lib/active_interaction/errors.rb,
lib/active_interaction/filter.rb,
lib/active_interaction/inputs.rb,
lib/active_interaction/version.rb,
lib/active_interaction/exceptions.rb,
lib/active_interaction/hash_input.rb,
lib/active_interaction/array_input.rb,
lib/active_interaction/filter/error.rb,
lib/active_interaction/filter/column.rb,
lib/active_interaction/grouped_input.rb,
lib/active_interaction/concerns/hashable.rb,
lib/active_interaction/concerns/missable.rb,
lib/active_interaction/concerns/runnable.rb,
lib/active_interaction/modules/validation.rb,
lib/active_interaction/filters/date_filter.rb,
lib/active_interaction/filters/file_filter.rb,
lib/active_interaction/filters/hash_filter.rb,
lib/active_interaction/filters/time_filter.rb,
lib/active_interaction/filters/array_filter.rb,
lib/active_interaction/filters/float_filter.rb,
lib/active_interaction/filters/object_filter.rb,
lib/active_interaction/filters/record_filter.rb,
lib/active_interaction/filters/string_filter.rb,
lib/active_interaction/filters/symbol_filter.rb,
lib/active_interaction/filters/boolean_filter.rb,
lib/active_interaction/filters/decimal_filter.rb,
lib/active_interaction/filters/integer_filter.rb,
lib/active_interaction/filters/date_time_filter.rb,
lib/active_interaction/filters/interface_filter.rb,
lib/active_interaction/concerns/active_modelable.rb,
lib/active_interaction/concerns/active_recordable.rb,
lib/active_interaction/filters/abstract_numeric_filter.rb,
lib/active_interaction/filters/abstract_date_time_filter.rb
Overview
Manage application specific business logic.
Defined Under Namespace
Classes: ArrayInput, Base, Errors, Filter, HashInput, Input, Inputs, InvalidInteractionError
Constant Summary collapse
- VERSION =
The version number.
Gem::Version.new('5.4.0')
- Error =
Top-level error class. All other errors subclass this.
Class.new(StandardError)
- InvalidNameError =
Raised if a constant name is invalid.
Class.new(Error)
- InvalidConverterError =
Raised if a converter is invalid.
Class.new(Error)
- InvalidDefaultError =
Raised if a default value is invalid.
Class.new(Error)
- InvalidFilterError =
Raised if a filter has an invalid definition.
Class.new(Error)
- MissingFilterError =
Raised if a filter cannot be found.
Class.new(Error)
- NoDefaultError =
Raised if there is no default value.
Class.new(Error)
Class Method Summary collapse
-
.array(*attributes, options = {}, &block) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes are Arrays.
-
.boolean(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes are Booleans.
-
.date(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes are Dates.
-
.date_time(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes are DateTimes.
-
.decimal(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes are BigDecimals.
-
.file(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes respond to the
rewind
method. -
.float(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes are Floats.
-
.hash(*attributes, options = {}, &block) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes are Hashes.
-
.integer(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes are Integers.
-
.interface(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes implement an interface.
-
.object(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes are the correct class.
-
.record(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes are the correct class.
-
.string(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes are Strings.
-
.symbol(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes are Symbols.
-
.time(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes are Times.
Class Method Details
.array(*attributes, options = {}, &block) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes are Arrays.
|
# File 'lib/active_interaction/filters/array_filter.rb', line 5
|
.boolean(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to
the attributes are Booleans. The strings "1"
, "true"
, and "on"
(case-insensitive) are converted to true
while the strings "0"
,
"false"
, and "off"
are converted to false
. Blank strings are
treated as a nil
value.
|
# File 'lib/active_interaction/filters/boolean_filter.rb', line 5
|
.date(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to
the attributes are Dates. String values are processed using parse
unless the format option is given, in which case they will be
processed with strptime
. Blank strings are treated as a nil
value.
|
# File 'lib/active_interaction/filters/date_filter.rb', line 5
|
.date_time(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to
the attributes are DateTimes. String values are processed using
parse
unless the format option is given, in which case they will be
processed with strptime
. Blank strings are treated as a nil
value.
|
# File 'lib/active_interaction/filters/date_time_filter.rb', line 5
|
.decimal(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to
the attributes are BigDecimals. Numerics and String values are
converted into BigDecimals. Blank strings are treated as a nil
value.
|
# File 'lib/active_interaction/filters/decimal_filter.rb', line 7
|
.file(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to
the attributes respond to the rewind
method. This is useful when
passing in Rails params that include a file upload or another generic
IO object.
|
# File 'lib/active_interaction/filters/file_filter.rb', line 5
|
.float(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to
the attributes are Floats. Integer and String values are converted
into Floats. Blank strings are treated as a nil
value.
|
# File 'lib/active_interaction/filters/float_filter.rb', line 5
|
.hash(*attributes, options = {}, &block) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes are Hashes.
|
# File 'lib/active_interaction/filters/hash_filter.rb', line 5
|
.integer(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to
the attributes are Integers. String values are converted into
Integers. Blank strings are treated as a nil
value.
|
# File 'lib/active_interaction/filters/integer_filter.rb', line 5
|
.interface(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes implement an interface. An interface can be based on a set of methods or the existance of a class or module in the ancestors of the passed value.
|
# File 'lib/active_interaction/filters/interface_filter.rb', line 5
|
.object(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes are the correct class.
|
# File 'lib/active_interaction/filters/object_filter.rb', line 5
|
.record(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to
the attributes are the correct class. Blank strings passed in will be
treated as nil
and the finder
will not be called.
|
# File 'lib/active_interaction/filters/record_filter.rb', line 5
|
.string(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes are Strings.
|
# File 'lib/active_interaction/filters/string_filter.rb', line 5
|
.symbol(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to the attributes are Symbols. Strings will be converted to Symbols.
|
# File 'lib/active_interaction/filters/symbol_filter.rb', line 5
|
.time(*attributes, options = {}) ⇒ Object
Creates accessors for the attributes and ensures that values passed to
the attributes are Times. Numeric values are processed using at
.
Strings are processed using parse
unless the format option is
given, in which case they will be processed with strptime
. Blank
strings are treated as a nil
value. If Time.zone
is available it
will be used so that the values are time zone aware.
|
# File 'lib/active_interaction/filters/time_filter.rb', line 5
|