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 +4 -4
- data/lib/publicstorage/dimensions.rb +22 -11
- data/lib/publicstorage/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f797ad8918b9cea8da35957e83b8bbf56ab02f1bfae95ee24a0fe1a316d1117d
|
4
|
+
data.tar.gz: e2a976a36b0fc0d5edefde19c7234b778257341abc9c9507029bac2d6e31f1e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 +
|
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]
|
17
|
-
#
|
18
|
-
attr_accessor :
|
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
|
23
|
-
def initialize(depth:, width:,
|
24
|
+
# @param height [Float]
|
25
|
+
def initialize(depth:, width:, height: DEFAULT_HEIGHT)
|
24
26
|
@depth = depth
|
25
27
|
@width = width
|
26
|
-
@
|
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
|
-
"
|
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)}' (#{
|
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:,
|
64
|
+
new(depth:, width:, height: DEFAULT_HEIGHT)
|
54
65
|
end
|
55
66
|
end
|
56
67
|
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.
|
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:
|
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.
|
104
|
-
changelog_uri: https://github.com/ksylvest/publicstorage/releases/tag/v1.
|
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: []
|