lighterpack-parser 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b692835b5b950b2892cc8ea192966625ff52d5237ff94715b9c63689ccb9cec4
4
- data.tar.gz: dbff07f7be838fcc24a04d116d359bc880cb59aa5992434abf904262247d206d
3
+ metadata.gz: 7aad45ab474c77260d595b41456b949ab8d3ad658bd5a13d32cfd48728323def
4
+ data.tar.gz: '09ecbf0c0036256a9cf0cfd6657150775ba0b94b08144431e54a536465592695'
5
5
  SHA512:
6
- metadata.gz: 3defc27122c9cf2c813e3869f7c5a3ab4172ffe3da706da64de7e6e92d4c771849efadcdabce1af8e2b989dcedd9c91acf14ef6da1c126f873674bc068e4e144
7
- data.tar.gz: f198b1e0d4c4776f48b178bfdf76fc3281d48e383adf709011eca040d43473b75b74f0a5b76aa748eef2bc0293430e7d4f4cb1d14bb22844e7ac74725e363584
6
+ metadata.gz: e632d196be2456197d2081a5de0ddc10b9bff3efbba3d34920a0795027cdc6b0e8a4869e7a827e4b41069a5d98c943a466266409af1c6916a65ded252ebd9fcb
7
+ data.tar.gz: 40633982fd1e80c6e34145b1c4d0dab8cfdfc83475d67f442404242a087db9ed6ebdb7346a87a54394d0f9f24af3c111f89171e9e589478eee2346011e1efa05
@@ -69,24 +69,5 @@ module LighterpackParser
69
69
  total_worn_weight: total_worn_weight
70
70
  }
71
71
  end
72
- alias worn? worn
73
- alias consumable? consumable
74
-
75
- # Convert to hash
76
- #
77
- # @return [Hash] Hash representation of the item
78
- def to_h
79
- {
80
- name: name, description: description,
81
- weight: weight, total_weight: total_weight,
82
-
83
- quantity: quantity,
84
- image_url: image_url,
85
- consumable: consumable,
86
- total_consumable_weight: total_consumable_weight,
87
- worn: worn, worn_quantity: worn_quantity,
88
- total_worn_weight: total_worn_weight
89
- }
90
- end
91
72
  end
92
73
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LighterpackParser
4
- VERSION = '1.0.1'
4
+ VERSION = '1.0.2'
5
5
  end
data/spec/item_spec.rb ADDED
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'open3'
4
+ require 'rbconfig'
5
+ require 'spec_helper'
6
+
7
+ RSpec.describe LighterpackParser::Item do
8
+ subject(:item) do
9
+ described_class.new(
10
+ name: 'Trail runners',
11
+ description: 'Worn on approach',
12
+ weight: 320.5,
13
+ total_weight: 641.0,
14
+ quantity: 2,
15
+ image_url: 'https://example.com/item.png',
16
+ consumable: true,
17
+ total_consumable_weight: 641.0,
18
+ worn: true,
19
+ worn_quantity: 1,
20
+ total_worn_weight: 320.5
21
+ )
22
+ end
23
+
24
+ describe 'predicate helpers' do
25
+ it 'keeps the boolean reader methods available as predicates' do
26
+ expect(item.worn?).to be(true)
27
+ expect(item.consumable?).to be(true)
28
+ end
29
+ end
30
+
31
+ describe '#to_h' do
32
+ it 'returns the same public hash representation' do
33
+ expect(item.to_h).to eq(
34
+ name: 'Trail runners',
35
+ description: 'Worn on approach',
36
+ weight: 320.5,
37
+ total_weight: 641.0,
38
+ quantity: 2,
39
+ image_url: 'https://example.com/item.png',
40
+ consumable: true,
41
+ total_consumable_weight: 641.0,
42
+ worn: true,
43
+ worn_quantity: 1,
44
+ total_worn_weight: 320.5
45
+ )
46
+ end
47
+ end
48
+
49
+ describe 'loading the file' do
50
+ it 'does not emit method redefinition warnings' do
51
+ stdout, stderr, status = Open3.capture3(
52
+ RbConfig.ruby,
53
+ '-w',
54
+ '-I',
55
+ File.expand_path('../lib', __dir__),
56
+ '-e',
57
+ 'require "lighterpack_parser/item"'
58
+ )
59
+
60
+ aggregate_failures do
61
+ expect(status.success?).to be(true), stdout + stderr
62
+ expect(stderr).not_to include('method redefined')
63
+ expect(stderr).not_to include('previous definition of')
64
+ end
65
+ end
66
+ end
67
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lighterpack-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Packlista Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-28 00:00:00.000000000 Z
11
+ date: 2026-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -75,6 +75,7 @@ files:
75
75
  - spec/fixtures/adbf7c.html
76
76
  - spec/fixtures/b6q1kr.html
77
77
  - spec/fixtures/h23rxt.html
78
+ - spec/item_spec.rb
78
79
  - spec/parser_spec.rb
79
80
  - spec/spec_helper.rb
80
81
  homepage: https://github.com/goulight/lighterpack-parser