module Gorillib::Model::Lint
A set of guards for good behavior:
-
checks that fields given to
read_attribute
,write_attribute
, etc are defined
Public Instance Methods
attribute_set?(field_name, *)
click to toggle source
Calls superclass method
# File lib/gorillib/model/lint.rb, line 12 def attribute_set?(field_name, *) check_field(field_name) ; super ; end
read_attribute(field_name, *)
click to toggle source
Calls superclass method
# File lib/gorillib/model/lint.rb, line 9 def read_attribute(field_name, *) check_field(field_name) ; super ; end
unset_attribute(field_name, *)
click to toggle source
Calls superclass method
# File lib/gorillib/model/lint.rb, line 11 def unset_attribute(field_name, *) check_field(field_name) ; super ; end
write_attribute(field_name, *)
click to toggle source
Calls superclass method
# File lib/gorillib/model/lint.rb, line 10 def write_attribute(field_name, *) check_field(field_name) ; super ; end
Protected Instance Methods
check_field(field_name)
click to toggle source
@return [true] if the field exists @raise [UnknownFieldError] if the field is missing
# File lib/gorillib/model/lint.rb, line 17 def check_field(field_name) return true if self.class.has_field?(field_name) raise UnknownFieldError, "unknown field: #{field_name} for #{self}" end