publicstorage 1.0.0 → 1.1.0

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: 385e04642b7995999e422333ae7c251c4e3556ae9958b0df0f35a387ca35297a
4
- data.tar.gz: 0c99f850bedd80f482187364625aa583518768ad6fc7f4b749f5dafdfe0871d8
3
+ metadata.gz: f797ad8918b9cea8da35957e83b8bbf56ab02f1bfae95ee24a0fe1a316d1117d
4
+ data.tar.gz: e2a976a36b0fc0d5edefde19c7234b778257341abc9c9507029bac2d6e31f1e3
5
5
  SHA512:
6
- metadata.gz: 25af8483c84aded81acac087be7e7bf7c42a404200d8d1091b7f32184de6a61fd6abccdff9cd4d6b2efcf582f3619c37250adeb21440232d3afa90c685ea2894
7
- data.tar.gz: d623ad587cb3c5b3d33aad2221002a411211f1cc5d39741b86e1ffa9f64732bc1ba9220a72e7e05bec40e852589a8ce09097a89ac22db489bda30df7776d3322
6
+ metadata.gz: eb338e5697de874ba118f47828d19ed3ed817cd136aac67372064fcea2dabde722c34cb39924b55e91bbbca3802b8469b7caf6a5fef5fa64abf559a2c2e38090
7
+ data.tar.gz: 8ed743ff4a0a59deefe92064d62345d6deaaceb860e597583758b8e7d18eac6f0db6b12f67ef0324212882ef1fea14009501b2ab0566d139241ae4d78d60f7eb
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PublicStorage
4
- # The dimensions (width + depth + sqft) of a price.
4
+ # The dimensions (width + depth + height) of a price.
5
5
  class Dimensions
6
+ DEFAULT_HEIGHT = 8.0 # feet
7
+
6
8
  SELECTOR = '.unit-size'
7
9
 
8
10
  # @attribute [rw] depth
@@ -13,17 +15,17 @@ module PublicStorage
13
15
  # @return [Integer]
14
16
  attr_accessor :width
15
17
 
16
- # @attribute [rw] sqft
17
- # @return [Integer]
18
- attr_accessor :sqft
18
+ # @attribute [rw] height
19
+ # @return [Integer]
20
+ attr_accessor :height
19
21
 
20
22
  # @param depth [Float]
21
23
  # @param width [Float]
22
- # @param sqft [Integer]
23
- def initialize(depth:, width:, sqft:)
24
+ # @param height [Float]
25
+ def initialize(depth:, width:, height: DEFAULT_HEIGHT)
24
26
  @depth = depth
25
27
  @width = width
26
- @sqft = sqft
28
+ @height = height
27
29
  end
28
30
 
29
31
  # @return [String]
@@ -31,14 +33,24 @@ module PublicStorage
31
33
  props = [
32
34
  "depth=#{@depth.inspect}",
33
35
  "width=#{@width.inspect}",
34
- "sqft=#{@sqft.inspect}"
36
+ "height=#{@height.inspect}"
35
37
  ]
36
38
  "#<#{self.class.name} #{props.join(' ')}>"
37
39
  end
38
40
 
39
41
  # @return [String] e.g. "10' × 10' (100 sqft)"
40
42
  def text
41
- "#{format('%g', @width)}' × #{format('%g', @depth)}' (#{@sqft} sqft)"
43
+ "#{format('%g', @width)}' × #{format('%g', @depth)}' (#{sqft} sqft)"
44
+ end
45
+
46
+ # @return [Integer]
47
+ def sqft
48
+ Integer(@width * @depth)
49
+ end
50
+
51
+ # @return [Integer]
52
+ def cuft
53
+ Integer(@width * @depth * @height)
42
54
  end
43
55
 
44
56
  # @param data [Hash]
@@ -48,9 +60,8 @@ module PublicStorage
48
60
  match = data['dimension'].match(/(?<depth>[\d\.]+)'x(?<width>[\d\.]+)'/)
49
61
  depth = Float(match[:depth])
50
62
  width = Float(match[:width])
51
- sqft = Integer(depth * width)
52
63
 
53
- new(depth:, width:, sqft:)
64
+ new(depth:, width:, height: DEFAULT_HEIGHT)
54
65
  end
55
66
  end
56
67
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PublicStorage
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: publicstorage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-18 00:00:00.000000000 Z
11
+ date: 2025-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -100,8 +100,8 @@ licenses:
100
100
  metadata:
101
101
  rubygems_mfa_required: 'true'
102
102
  homepage_uri: https://github.com/ksylvest/publicstorage
103
- source_code_uri: https://github.com/ksylvest/publicstorage/tree/v1.0.0
104
- changelog_uri: https://github.com/ksylvest/publicstorage/releases/tag/v1.0.0
103
+ source_code_uri: https://github.com/ksylvest/publicstorage/tree/v1.1.0
104
+ changelog_uri: https://github.com/ksylvest/publicstorage/releases/tag/v1.1.0
105
105
  documentation_uri: https://publicstorage.ksylvest.com/
106
106
  post_install_message:
107
107
  rdoc_options: []