M spec/cbor/encoder_spec.cr => spec/cbor/encoder_spec.cr +1 -1
@@ 71,7 71,7 @@ describe CBOR::Encoder do
bytes_arr = hex_string.split.map(&.to_u8(16))
want_bytes = Bytes.new(bytes_arr.to_unsafe, bytes_arr.size)
- it "econdes #{value.to_s} to #{want_bytes.hexstring}" do
+ it "encodes #{value} to #{want_bytes.hexstring}" do
res = IO::Memory.new
encoder = CBOR::Encoder.new(res)
M spec/cbor/lexer_spec.cr => spec/cbor/lexer_spec.cr +1 -1
@@ 21,7 21,7 @@ describe CBOR::Lexer do
]
tests.each do |tt|
- it "reads #{tt[:bytes].hexstring} as #{tt[:value].to_s}" do
+ it "reads #{tt[:bytes].hexstring} as #{tt[:value]}" do
lexer = CBOR::Lexer.new(tt[:bytes])
token = lexer.next_token
M spec/cbor/to_cbor_spec.cr => spec/cbor/to_cbor_spec.cr +1 -1
@@ 41,7 41,7 @@ describe "to_cbor" do
tests.each do |tt|
type, bytes, value = tt
- it "encodes #{value.inspect} of type #{type.to_s}" do
+ it "encodes #{value.inspect} of type #{type}" do
res = value.to_cbor
res.hexdump.should eq(bytes.hexdump)
end
M src/cbor/diagnostic.cr => src/cbor/diagnostic.cr +2 -2
@@ 1,5 1,5 @@
# Reads a CBOR input into a diagnostic string.
-# This consumes the IO and is mostly usedful to tests again the example
+# This consumes the IO and is mostly useful to tests again the example
# provided in the RFC and ensuring a correct functioning of the `CBOR::Lexer`.
class CBOR::Diagnostic
@lexer : Lexer
@@ 63,7 63,7 @@ class CBOR::Diagnostic
when Tag::NegativeBigNum
read_big_int(negative: true)
else
- "#{token.value.value.to_s}(#{next_value})"
+ "#{token.value.value}(#{next_value})"
end
when Token::FloatT
return "NaN" if token.value.nan?
M src/cbor/encoder.cr => src/cbor/encoder.cr +1 -1
@@ 48,7 48,7 @@ class CBOR::Encoder
return write(value.to_u64) if value >= 0
# When it's negative, transform it into a positive value and write the
- # resulting unsigled int with an offset
+ # resulting unsigned int with an offset
positive_value = -(value + 1)
write(positive_value.to_u64, 0x20)
end
M src/cbor/from_cbor.cr => src/cbor/from_cbor.cr +2 -2
@@ 180,7 180,7 @@ def BigInt.new(decoder : CBOR::Decoder)
end
# Reads the CBOR value as a BigDecimal.
-# If the next token is a flaot, then it'll be transformed to a BigDecimal,
+# If the next token is a float, then it'll be transformed to a BigDecimal,
# otherwhise the value must be correctly tagged with value 4 (decimal fraction)
# or 5 (big float).
def BigDecimal.new(decoder : CBOR::Decoder)
@@ 231,7 231,7 @@ def Union.new(decoder : CBOR::Decoder)
return {{type}}.new(decoder)
{% end %}
else
- # This case check is non-exaustive on purpose
+ # This case check is non-exhaustive on purpose
end
{% end %}
M src/cbor/lexer.cr => src/cbor/lexer.cr +2 -2
@@ 164,7 164,7 @@ class CBOR::Lexer
end
private def consume_simple_value(id) : Token::SimpleValueT
- raise ParseError.new("Invalid simple value #{id.to_s}") if id > 255
+ raise ParseError.new("Invalid simple value #{id}") if id > 255
Token::SimpleValueT.new(value: SimpleValue.new(id.to_u8))
end
@@ 176,7 176,7 @@ class CBOR::Lexer
{% conv = %w(to_i8 to_i16 to_i32 to_i64 to_i128) %}
{% for uint, index in uints %}
- # Reads the `{{uint.id}}` as a negative integer, returning the samllest
+ # Reads the `{{uint.id}}` as a negative integer, returning the smallest
# integer capable of containing the value.
def to_negative_int(value : {{uint.id}})
int = begin
M src/cbor/serializable.cr => src/cbor/serializable.cr +1 -1
@@ 143,7 143,7 @@ module CBOR
end
# When the type is inherited, carry over the `new`
- # so it can compete with other possible intializes
+ # so it can compete with other possible initializes
macro inherited
def self.new(decoder : ::CBOR::Decoder)
M src/cbor/simple_value.cr => src/cbor/simple_value.cr +1 -1
@@ 15,7 15,7 @@ enum CBOR::SimpleValue : UInt8
when Undefined
"undefined"
else
- "simple(#{self.value.to_s})"
+ "simple(#{self.value})"
end
end
M src/cbor/to_cbor.cr => src/cbor/to_cbor.cr +2 -2
@@ 79,7 79,7 @@ module Time::Format::RFC_3339
end
module Time::EpochConverter
- # Emits the time as a tagged unix timestamp, asp specified by
+ # Emits the time as a tagged unix timestamp, as specified by
# [RFC 7049 section 2.4.1](https://tools.ietf.org/html/rfc7049#section-2.4.1).
#
def self.to_cbor(value : Time, encoder : CBOR::Encoder)
@@ 108,7 108,7 @@ struct Time
end
# struct BigInt
-# # Encodes the value a bytes arrya tagged with the CBOR tag 2 or 3, as specified
+# # Encodes the value a bytes array tagged with the CBOR tag 2 or 3, as specified
# # in [RFC 7049 Section 2.4.2](https://tools.ietf.org/html/rfc7049#section-2.4.2).
# def to_cbor(encoder : CBOR::Encoder)
# encoded_value = BigInt.new(self)