Sha256: 0540180a9bcddea17555b7cf7d25ec33397a12266e768fed0582c6ec1c0b2174

Contents?: true

Size: 850 Bytes

Versions: 4

Compression:

Stored size: 850 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

4 entries across 4 versions & 1 rubygems

Version Path
fit_parser-1.0.3 lib/bindata/dsl_field_validator.rb
fit_parser-1.0.2 lib/bindata/dsl_field_validator.rb
fit_parser-1.0.1 lib/bindata/dsl_field_validator.rb
fit_parser-1.0.0 lib/bindata/dsl_field_validator.rb