Sha256: eedba9e1787f12fb9a7070cf0ddfcee16800da278c690243a002b715bc3fc3af

Contents?: true

Size: 852 Bytes

Versions: 6

Compression:

Stored size: 852 Bytes

Contents

# Override DSLFieldValidator#ensure_valid_name from bindata/lib/dsl.rb
# gem bindata
# because we should not raise error on duplicate name
module BinData
  module DSLMixin
    class DSLFieldValidator
      def ensure_valid_name(name)
        if name and not option?(:fieldnames_are_values)
          if malformed_name?(name)
            # raise NameError.new("", name), "field '#{name}' is an illegal fieldname"
          end

          if duplicate_name?(name)
            # raise SyntaxError, "duplicate field '#{name}'"
          end

          if name_shadows_method?(name)
            raise NameError.new("", name), "field '#{name}' shadows an existing method"
          end

          if name_is_reserved?(name)
            raise NameError.new("", name), "field '#{name}' is a reserved name"
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fit_parser-1.0.9 lib/bindata/dsl_field_validator.rb
fit_parser-1.0.8 lib/bindata/dsl_field_validator.rb
fit_parser-1.0.7 lib/bindata/dsl_field_validator.rb
fit_parser-1.0.6 lib/bindata/dsl_field_validator.rb
fit_parser-1.0.5 lib/bindata/dsl_field_validator.rb
fit_parser-1.0.4 lib/bindata/dsl_field_validator.rb