concrete_contractors_estimator 1.0.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4d16672aa7505b2f08ff2e675fb973bafe0d0caaaf535c79e35bebdb71b5053f
4
+ data.tar.gz: 8db3b73c1c7c8a9f945918421fa9d54d60d6a36f200bf3a86a27b1d419871e24
5
+ SHA512:
6
+ metadata.gz: a10e367120bf01a70eff586804f554dcdd82df70fec1fd8e2a2ef8af5415eb42e727575869b5e332cc8ae7d609388cd21ce193da52b47ba7ededfc2fae7e43ca
7
+ data.tar.gz: a9681302b9c09685c76df59f22fe6fbf75486676468e2b67d8e11403eeb2679dbcdc8af07032d09afca5da1cc9fddb68c22fa1a50ae088f21b37f605e8683be5
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Phoenix Concrete Contractors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # Concrete Contractors Estimator (Ruby)
2
+
3
+ `concrete_contractors_estimator` is a dependency-free Ruby library and CLI for the take-off concrete contractors do
4
+ before a pour: volume for slabs, driveways, patios, footings, round columns and steps, a waste factor, cubic
5
+ yards to order, 80/60/40 lb bag counts, rebar or wire-mesh quantities, a rough installed cost range and
6
+ hot-weather pour advice for desert summers.
7
+
8
+ ```bash
9
+ gem install concrete_contractors_estimator
10
+ concrete_contractors_estimator slab 24 12 4 stamped
11
+ concrete_contractors_estimator pour 108 7
12
+ ```
13
+
14
+ ```ruby
15
+ require "concrete_contractors_estimator"
16
+ C = ConcreteContractorsEstimator
17
+
18
+ C.estimate(C.slab_volume(20, 10, 4))
19
+ # => {cubic_feet: 73.33, cubic_yards: 2.72, order_yards: 2.75, bags80: 123, bags60: 163, bags40: 245, suggestion: "ready-mix"}
20
+ C.rebar(20, 10, 18) # 280 ft, 16 x 20 ft sticks
21
+ C.cost_range(200, finish: "stamped", thickness_in: 5, remove_old: true) # {low: 3040, high: 5200, currency: "USD"}
22
+ C.pour_advice(112, 7)[:risk] # "extreme"
23
+ ```
24
+
25
+ | Function | Returns |
26
+ |---|---|
27
+ | `slab_volume`, `footing_volume`, `column_volume`, `steps_volume` | cubic feet |
28
+ | `estimate(cubic_feet, waste = 0.10)` | cubic feet/yards with waste, order yards, 80/60/40 lb bags, bags vs ready-mix |
29
+ | `rebar(length_ft, width_ft, spacing_in = 18)` | bars each way, linear feet, 20 ft sticks (10 % lap) |
30
+ | `mesh_sheets(area_sq_ft)` | 5 x 10 ft welded-wire sheets |
31
+ | `cost_range(area, finish:, thickness_in:, remove_old:)` | rough USD range for broom, colored, exposed or stamped flatwork |
32
+ | `pour_advice(forecast_high_f, month = nil)` | heat risk, start window, tips, monsoon flag, cure days |
33
+
34
+ Same formulas as the JavaScript, Python, Rust, Dart, C# and PHP versions (see `SPEC.md` in the repository).
35
+ Cost figures are planning numbers, not a quote.
36
+
37
+ ## Links
38
+
39
+ - Driveways, patios, stamped concrete and repairs planned for desert heat: [Concrete Contractors Phoenix](https://concretecontractorsphoenix.net/)
40
+ - Source: https://github.com/nbkdevs/concrete-contractors-phoenix
41
+
42
+ MIT licensed.
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "concrete_contractors_estimator"
5
+ C = ConcreteContractorsEstimator
6
+
7
+ def show(shape, e)
8
+ puts "#{shape}: #{e[:cubic_yards]} yd3 (#{e[:cubic_feet]} ft3 incl. waste) - order #{e[:order_yards]} yd3"
9
+ puts "Bags: #{e[:bags80]} x 80 lb, #{e[:bags60]} x 60 lb or #{e[:bags40]} x 40 lb"
10
+ puts "Suggestion: #{e[:suggestion]}"
11
+ end
12
+
13
+ a = ARGV
14
+ n = ->(i) { Float(a.fetch(i)) }
15
+ begin
16
+ case a[0]
17
+ when "slab"
18
+ l, w, t = n[1], n[2], n[3]
19
+ show("slab", C.estimate(C.slab_volume(l, w, t)))
20
+ rb = C.rebar(l, w)
21
+ puts "Rebar: #{rb[:linear_feet]} ft (#{rb[:sticks20]} x 20 ft sticks) or #{C.mesh_sheets(l * w)} mesh sheets"
22
+ c = C.cost_range(l * w, finish: a[4] || "broom", thickness_in: t)
23
+ puts "Rough installed cost: $#{c[:low]} - $#{c[:high]}"
24
+ when "footing" then show("footing", C.estimate(C.footing_volume(n[1], n[2], n[3])))
25
+ when "column" then show("column", C.estimate(C.column_volume(n[1], n[2], a[3] ? Integer(a[3]) : 1)))
26
+ when "steps" then show("steps", C.estimate(C.steps_volume(Integer(a[1]), n[2], n[3], n[4])))
27
+ when "pour"
28
+ p = C.pour_advice(n[1], a[2] ? Integer(a[2]) : nil)
29
+ puts "Heat risk: #{p[:risk]}", "Start: #{p[:start]}"
30
+ p[:tips].each { |t| puts "- #{t}" }
31
+ else
32
+ puts "Usage: concrete_contractors_estimator slab|footing|column|steps|pour ...",
33
+ " slab <length-ft> <width-ft> <thickness-in> [finish]",
34
+ " footing <length-ft> <width-in> <depth-in>",
35
+ " column <diameter-in> <height-ft> [count]",
36
+ " steps <steps> <rise-in> <run-in> <width-ft>",
37
+ " pour <forecast-high-F> [month]"
38
+ end
39
+ rescue ArgumentError, IndexError, TypeError => e
40
+ warn "Error: #{e.message}"
41
+ exit 1
42
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ConcreteContractorsEstimator
4
+ VERSION = "1.0.0"
5
+ end
@@ -0,0 +1,108 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "concrete_contractors_estimator/version"
4
+
5
+ # Concrete take-off formulas shared with the JavaScript, Python, Rust, Dart, C# and PHP packages.
6
+ module ConcreteContractorsEstimator
7
+ BAG_YIELD = { 80 => 0.60, 60 => 0.45, 40 => 0.30 }.freeze
8
+ FINISHES = { "broom" => [6, 10], "colored" => [8, 13], "exposed" => [9, 14], "stamped" => [12, 20] }.freeze
9
+ CURE = { foot_traffic_days: 2, vehicle_days: 7, moist_cure_days: 7, full_strength_days: 28 }.freeze
10
+
11
+ module_function
12
+
13
+ def pos(name, v)
14
+ raise ArgumentError, "#{name} must be a positive number" unless v.is_a?(Numeric) && v.finite? && v.positive?
15
+
16
+ v.to_f
17
+ end
18
+
19
+ def r2(x) = ((x * 100) + 0.5 + 1e-9).floor / 100.0
20
+ def ceil6(x) = x.round(6).ceil
21
+
22
+ # Cubic feet for a slab, driveway or patio.
23
+ def slab_volume(length_ft, width_ft, thickness_in)
24
+ pos("length", length_ft) * pos("width", width_ft) * pos("thickness", thickness_in) / 12
25
+ end
26
+
27
+ # Cubic feet for a continuous footing.
28
+ def footing_volume(length_ft, width_in, depth_in)
29
+ pos("length", length_ft) * pos("width", width_in) / 12 * pos("depth", depth_in) / 12
30
+ end
31
+
32
+ # Cubic feet for round columns or sonotubes.
33
+ def column_volume(diameter_in, height_ft, count = 1)
34
+ r = pos("diameter", diameter_in) / 24
35
+ Math::PI * r * r * pos("height", height_ft) * pos("count", count)
36
+ end
37
+
38
+ # Cubic feet for a solid stair poured on grade.
39
+ def steps_volume(steps, rise_in, run_in, width_ft)
40
+ raise ArgumentError, "steps must be a whole number" unless steps.is_a?(Integer)
41
+
42
+ n = pos("steps", steps)
43
+ pos("width", width_ft) * pos("run", run_in) / 12 * pos("rise", rise_in) / 12 * n * (n + 1) / 2
44
+ end
45
+
46
+ # Adds waste (0.10 = 10 %) and converts to yards and bags.
47
+ def estimate(cubic_feet, waste = 0.10)
48
+ pos("volume", cubic_feet)
49
+ raise ArgumentError, "waste is a fraction between 0 and 1" unless waste.is_a?(Numeric) && waste >= 0 && waste <= 1
50
+
51
+ v = cubic_feet * (1 + waste)
52
+ yd = v / 27.0
53
+ {
54
+ cubic_feet: r2(v), cubic_yards: r2(yd), order_yards: (yd * 4).round(6).ceil / 4.0,
55
+ bags80: ceil6(v / 0.60), bags60: ceil6(v / 0.45), bags40: ceil6(v / 0.30),
56
+ suggestion: yd < 1 ? "bags" : "ready-mix"
57
+ }
58
+ end
59
+
60
+ # Rebar grid for a slab at spacing_in on center, 10 % lap on 20 ft sticks.
61
+ def rebar(length_ft, width_ft, spacing_in = 18)
62
+ pos("length", length_ft); pos("width", width_ft); pos("spacing", spacing_in)
63
+ al = (width_ft * 12.0 / spacing_in).floor + 1
64
+ aw = (length_ft * 12.0 / spacing_in).floor + 1
65
+ lf = (al * length_ft) + (aw * width_ft)
66
+ { bars_along_length: al, bars_along_width: aw, linear_feet: r2(lf), sticks20: ceil6(lf * 1.1 / 20) }
67
+ end
68
+
69
+ # 5 x 10 ft welded-wire sheets with 10 % overlap.
70
+ def mesh_sheets(area_sq_ft) = ceil6(pos("area", area_sq_ft) * 1.1 / 50)
71
+
72
+ # Rough installed cost range in USD.
73
+ def cost_range(area_sq_ft, finish: "broom", thickness_in: 4, remove_old: false)
74
+ pos("area", area_sq_ft); pos("thickness", thickness_in)
75
+ f = FINISHES[finish.to_s] or raise ArgumentError, "finish must be one of: #{FINISHES.keys.join(', ')}"
76
+ m = thickness_in > 4 ? 1 + (0.1 * (thickness_in - 4)) : 1.0
77
+ dl, dh = remove_old ? [2, 4] : [0, 0]
78
+ { low: ((area_sq_ft * ((f[0] * m) + dl)) + 0.5).floor, high: ((area_sq_ft * ((f[1] * m) + dh)) + 0.5).floor, currency: "USD" }
79
+ end
80
+
81
+ # Hot-weather pour advice from the forecast high (F) and optional month (1-12).
82
+ def pour_advice(forecast_high_f, month = nil)
83
+ raise ArgumentError, "forecast high must be a number" unless forecast_high_f.is_a?(Numeric) && forecast_high_f.finite?
84
+ raise ArgumentError, "month must be 1-12" unless month.nil? || (month.is_a?(Integer) && month.between?(1, 12))
85
+
86
+ t = forecast_high_f
87
+ tips = ["Check the slump on arrival and do not add extra water to make it easier to place."]
88
+ risk, start =
89
+ if t < 90 then ["low", "Any time; finish before the afternoon peak."]
90
+ elsif t < 100 then ["moderate", "Start by 7:00 am."]
91
+ elsif t < 110 then ["high", "Start 5:00-6:00 am and finish by 10:00 am."]
92
+ else ["extreme", "Reschedule if you can; otherwise start at first light and finish by 9:00 am."]
93
+ end
94
+ if t >= 90
95
+ tips << "Pre-wet the subgrade and forms so dry desert soil does not pull water out of the mix."
96
+ tips << "Have the finishing crew and tools ready before the truck arrives; hot concrete sets fast."
97
+ end
98
+ if t >= 100
99
+ tips << "Ask the plant for a set-retarding admixture and keep the mix below 90 F (ice or chilled water)."
100
+ tips << "Put up shade or windbreaks; low humidity and wind cause plastic shrinkage cracks."
101
+ end
102
+ tips << "Use a smaller crew-sized pour or split the job; do not place more than you can finish in two hours." if t >= 110
103
+ tips << "Start curing right after finishing: curing compound, wet burlap or plastic sheeting, kept moist for 7 days."
104
+ monsoon = !month.nil? && month.between?(6, 9)
105
+ tips << "Monsoon season: watch for afternoon storm cells, keep plastic on site and route runoff away from the fresh slab." if monsoon
106
+ { risk: risk, start: start, tips: tips, monsoon: monsoon, cure: CURE.dup }
107
+ end
108
+ end
metadata ADDED
@@ -0,0 +1,51 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: concrete_contractors_estimator
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Phoenix Concrete Contractors
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: 'Take-off math concrete contractors use before a pour: slab, driveway,
13
+ patio, footing, column and steps volume with waste, cubic yards to order, 80/60/40
14
+ lb bag counts, rebar and mesh, a rough installed cost range and hot-weather pour
15
+ advice. Library and CLI, no dependencies.'
16
+ executables:
17
+ - concrete_contractors_estimator
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - LICENSE
22
+ - README.md
23
+ - exe/concrete_contractors_estimator
24
+ - lib/concrete_contractors_estimator.rb
25
+ - lib/concrete_contractors_estimator/version.rb
26
+ homepage: https://concretecontractorsphoenix.net/
27
+ licenses:
28
+ - MIT
29
+ metadata:
30
+ homepage_uri: https://concretecontractorsphoenix.net/
31
+ source_code_uri: https://github.com/nbkdevs/concrete-contractors-phoenix
32
+ bug_tracker_uri: https://github.com/nbkdevs/concrete-contractors-phoenix/issues
33
+ rdoc_options: []
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ requirements: []
47
+ rubygems_version: 4.0.20
48
+ specification_version: 4
49
+ summary: 'Concrete contractors estimator: volume, bag counts, rebar, cost range and
50
+ hot-weather pour advice'
51
+ test_files: []