intel_hex 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5381c2e993a9780fae3696528452bdae7b18060816785d296bd67be92096a65c
4
- data.tar.gz: b8c0e7c5b88c78eaeef8a0844a9e7b76d84731f2411aed1a367c9bc41087fda0
3
+ metadata.gz: 5f4dfc549e66964b205d64f063f38c1dc091e8bfc92755076c9f267d72f50422
4
+ data.tar.gz: 87e987fd8decf8520c5648ea524d0e79da09c0950a8713c887e8afc66ece629c
5
5
  SHA512:
6
- metadata.gz: 861c2a89ca8bcbd03e883835ab5d4343ab7e6e210e4338388fd26f21c4f50f7ed0a213b8c13f1c69fc10ad6f512d6a0e9dedd874337cedf2afdd4167d9bc12a5
7
- data.tar.gz: 194a5fd15404d29af5379e4d201761967f173359dfeb3d152df21d9d042b968ad10d6b42af61c61958eec056490f7e0b9227ac614c402d563ea9f2822f5f7e91
6
+ metadata.gz: ec5dd2ac67f7387f4602f2806633f0a26e717ed9a27b35f0ac01baee8a70856a485cbd63fb6a597841b0c29c14653d50daf8c1bb5a225bbd03d2106b73b65317
7
+ data.tar.gz: cfdace7c69d4f52cea5728b9d38851c6f0da2dc8f6e6e0669d05f99829296c17668e6fb0298d69b38673d5197c2c23a2205500e405a94cdce30b27b9efc2d819
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # An Intel hex file parser, for Ruby
2
2
 
3
- See the [Wikipedia page on Intel HEX](https://en.wikipedia.org/wiki/Intel_HEX).
3
+ [![rspec test status](https://github.com/jeremycole/intel_hex/actions/workflows/rspec.yml/badge.svg)](https://github.com/jeremycole/intel_hex/actions/workflows/rspec.yml)
4
4
 
5
- [![Build Status](https://travis-ci.org/jeremycole/intel_hex.svg?branch=master)](https://travis-ci.org/jeremycole/intel_hex)
5
+ See the [Wikipedia page on Intel HEX](https://en.wikipedia.org/wiki/Intel_HEX).
@@ -4,10 +4,15 @@ module IntelHex
4
4
  class MisformattedFileError < RuntimeError; end
5
5
 
6
6
  class ValidationError < StandardError; end
7
+
7
8
  class InvalidTypeError < ValidationError; end
9
+
8
10
  class InvalidLengthError < ValidationError; end
11
+
9
12
  class InvalidOffsetError < ValidationError; end
13
+
10
14
  class InvalidDataError < ValidationError; end
15
+
11
16
  class InvalidChecksumError < ValidationError; end
12
17
 
13
18
  class Record
@@ -40,7 +45,7 @@ module IntelHex
40
45
 
41
46
  offset = line[3..6].to_i(16)
42
47
  type = TYPES[line[7..8].to_i(16)]
43
- data = line[9...data_end].split('').each_slice(2).map { |a| a.join.to_i(16) }
48
+ data = line[9...data_end].chars.each_slice(2).map { |a| a.join.to_i(16) }
44
49
  checksum = line[data_end..(data_end + 2)].to_i(16)
45
50
 
46
51
  Record.new(type, length, offset, data, checksum, line: line, validate: true)
@@ -58,7 +63,7 @@ module IntelHex
58
63
 
59
64
  def self.type_with_value(type, value)
60
65
  record = Record.new(type)
61
- record.send((type.to_s + '=').to_sym, value)
66
+ record.send("#{type}=".to_sym, value)
62
67
  record
63
68
  end
64
69
 
@@ -78,12 +83,7 @@ module IntelHex
78
83
  type_with_value(:sla, value)
79
84
  end
80
85
 
81
- attr_reader :length
82
- attr_reader :offset
83
- attr_reader :type
84
- attr_reader :data
85
- attr_reader :checksum
86
- attr_reader :line
86
+ attr_reader :length, :offset, :type, :data, :checksum, :line
87
87
 
88
88
  # rubocop:disable Metrics/ParameterLists
89
89
  def initialize(type, length = 0, offset = 0, data = [], checksum = nil, line: nil, validate: false)
@@ -100,7 +100,7 @@ module IntelHex
100
100
  # rubocop:enable Metrics/ParameterLists
101
101
 
102
102
  def data_s
103
- '[' + data.map { |b| '%02x' % b }.join(' ') + ']'
103
+ "[#{data.map { |b| '%02x' % b }.join(' ')}]"
104
104
  end
105
105
 
106
106
  def value_s
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IntelHex
4
- VERSION = '0.5.4'
4
+ VERSION = '0.5.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intel_hex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Cole
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-15 00:00:00.000000000 Z
11
+ date: 2021-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop-rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  description: An Intel hex file parser for (e.g. AVR) working with firmware files
28
56
  email: jeremy@jcole.us
29
57
  executables:
@@ -50,7 +78,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
50
78
  requirements:
51
79
  - - ">="
52
80
  - !ruby/object:Gem::Version
53
- version: '0'
81
+ version: '2.6'
82
+ - - "<"
83
+ - !ruby/object:Gem::Version
84
+ version: '4'
54
85
  required_rubygems_version: !ruby/object:Gem::Requirement
55
86
  requirements:
56
87
  - - ">="