Sha256: 75abac68ac09c1ddd0b21500057a4c2fac77eeb4a64346c6647e2f5eeb8903f7
Contents?: true
Size: 1.83 KB
Versions: 1
Compression:
Stored size: 1.83 KB
Contents
# frozen_string_literal: true module Fluxo class Operation module Attributes def self.included(klass) klass.extend(ClassMethods) end module ClassMethods attr_reader :validations_proxy # When set to true, the operation will not validate the transient_attributes defition during the flow step execution. attr_writer :sloppy_transient_attributes # When set to true, the operation will not validate attributes definition before calling the operation. attr_writer :sloppy_attributes def sloppy_attributes? return @sloppy_attributes if defined?(@sloppy_attributes) Fluxo.config.sloppy_attributes end def sloppy_transient_attributes? return @sloppy_transient_attributes if defined?(@sloppy_transient_attributes) Fluxo.config.sloppy_transient_attributes end def validations raise NotImplementedError, "ActiveModel is not defined to use validations." end def attribute_names @attribute_names ||= [] end def transient_attribute_names @transient_attribute_names ||= [] end def attributes(*names) @attribute_names ||= [] names = names.map(&:to_sym) - @attribute_names @attribute_names.push(*names) end def transient_attributes(*names) @transient_attribute_names ||= [] names = names.map(&:to_sym) - @transient_attribute_names @transient_attribute_names.push(*names) end def attribute?(key) return false unless key attribute_names.include?(key.to_sym) end def transient_attribute?(key) return false unless key transient_attribute_names.include?(key.to_sym) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fluxo-0.1.0 | lib/fluxo/operation/attributes.rb |