You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OPF1.3 has many actions and most actions have some attributes therefore a common way to declare and validate attributes of such actions is needed. At the moment I am inclining to use the pattern used with activerecord validations. An example is always best.
class Action
include ActionHelper
end
class PushMpls < Action
def initialize ether_type
create_validate : :ether_type, :presence => true, :within => "ether_type_range", :validate_with => "unsigned_16bit_number", :value => ether_type
end
The above create_validate method would create the attribute ether_type and raise an exception if no value is given and for example call the validation functions ether_type_range and unsigned_16bit_number.
The text was updated successfully, but these errors were encountered:
OPF1.3 has many actions and most actions have some attributes therefore a common way to declare and validate attributes of such actions is needed. At the moment I am inclining to use the pattern used with activerecord validations. An example is always best.
The above create_validate method would create the attribute
ether_type
and raise an exception if no value is given and for example call the validation functionsether_type_range
andunsigned_16bit_number
.The text was updated successfully, but these errors were encountered: