Class: StructuraidCore::Elements::Reinforcement::Rebar

Inherits:
Base
  • Object
show all
Includes:
Utils::RebarData
Defined in:
lib/structuraid_core/elements/reinforcement/rebar.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::RebarData

#find_standard_diameter

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

#diameterObject (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_hookObject (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

#materialObject (readonly)

Returns the value of attribute material.



7
8
9
# File 'lib/structuraid_core/elements/reinforcement/rebar.rb', line 7

def material
  @material
end

#numberObject (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_hookObject (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

#areaObject



17
18
19
20
# File 'lib/structuraid_core/elements/reinforcement/rebar.rb', line 17

def area
  rebar_area = Math::PI * (diameter**2) / 4
  rebar_area.to_f
end

#delete_end_hookObject



39
40
41
# File 'lib/structuraid_core/elements/reinforcement/rebar.rb', line 39

def delete_end_hook
  @end_hook = nil
end

#delete_start_hookObject



35
36
37
# File 'lib/structuraid_core/elements/reinforcement/rebar.rb', line 35

def delete_start_hook
  @start_hook = nil
end

#perimeterObject



22
23
24
25
# File 'lib/structuraid_core/elements/reinforcement/rebar.rb', line 22

def perimeter
  rebar_perimeter = Math::PI * diameter
  rebar_perimeter.to_f
end