Class: StructuraidCore::Elements::Reinforcement::Rebar
- Includes:
- Utils::RebarData
- Defined in:
- lib/structuraid_core/elements/reinforcement/rebar.rb
Instance Attribute Summary collapse
-
#diameter ⇒ Object
readonly
Returns the value of attribute diameter.
-
#end_hook ⇒ Object
readonly
Returns the value of attribute end_hook.
-
#material ⇒ Object
readonly
Returns the value of attribute material.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#start_hook ⇒ Object
readonly
Returns the value of attribute start_hook.
Instance Method Summary collapse
- #add_end_hook(hook) ⇒ Object
- #add_start_hook(hook) ⇒ Object
- #area ⇒ Object
- #delete_end_hook ⇒ Object
- #delete_start_hook ⇒ Object
-
#initialize(number:, material:) ⇒ Rebar
constructor
A new instance of Rebar.
- #perimeter ⇒ Object
Methods included from Utils::RebarData
Constructor Details
#initialize(number:, material:) ⇒ Rebar
Returns a new instance of Rebar.
9 10 11 12 13 14 15 |
# File 'lib/structuraid_core/elements/reinforcement/rebar.rb', line 9 def initialize(number:, material:) @start_hook = nil @end_hook = nil @number = number @material = material @diameter = find_standard_diameter(rebar_number: number) end |
Instance Attribute Details
#diameter ⇒ Object (readonly)
Returns the value of attribute diameter.
7 8 9 |
# File 'lib/structuraid_core/elements/reinforcement/rebar.rb', line 7 def diameter @diameter end |
#end_hook ⇒ Object (readonly)
Returns the value of attribute end_hook.
7 8 9 |
# File 'lib/structuraid_core/elements/reinforcement/rebar.rb', line 7 def end_hook @end_hook end |
#material ⇒ Object (readonly)
Returns the value of attribute material.
7 8 9 |
# File 'lib/structuraid_core/elements/reinforcement/rebar.rb', line 7 def material @material end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
7 8 9 |
# File 'lib/structuraid_core/elements/reinforcement/rebar.rb', line 7 def number @number end |
#start_hook ⇒ Object (readonly)
Returns the value of attribute start_hook.
7 8 9 |
# File 'lib/structuraid_core/elements/reinforcement/rebar.rb', line 7 def start_hook @start_hook end |
Instance Method Details
#add_end_hook(hook) ⇒ Object
31 32 33 |
# File 'lib/structuraid_core/elements/reinforcement/rebar.rb', line 31 def add_end_hook(hook) @end_hook = hook end |
#add_start_hook(hook) ⇒ Object
27 28 29 |
# File 'lib/structuraid_core/elements/reinforcement/rebar.rb', line 27 def add_start_hook(hook) @start_hook = hook end |
#area ⇒ Object
17 18 19 20 |
# File 'lib/structuraid_core/elements/reinforcement/rebar.rb', line 17 def area = Math::PI * (diameter**2) / 4 .to_f end |
#delete_end_hook ⇒ Object
39 40 41 |
# File 'lib/structuraid_core/elements/reinforcement/rebar.rb', line 39 def delete_end_hook @end_hook = nil end |
#delete_start_hook ⇒ Object
35 36 37 |
# File 'lib/structuraid_core/elements/reinforcement/rebar.rb', line 35 def delete_start_hook @start_hook = nil end |
#perimeter ⇒ Object
22 23 24 25 |
# File 'lib/structuraid_core/elements/reinforcement/rebar.rb', line 22 def perimeter = Math::PI * diameter .to_f end |