lib/measures/tbd/resources/psi.rb
##
# Validate whether a stored PSI set has a complete list of PSI type:values
#
# @param [String] p A PSI set identifier
#
# @return [Bool] Returns true if stored and has a complete PSI set
Validate whether a stored PSI set has a complete list of PSI type:values
Validate whether a stored PSI set has a complete list of PSI type : values
def complete?(p)
    unless @set.has_key?(p) && @has.has_key?(p) && @val.has_key?(p)
      TBD.log(TBD::ERROR,
        "Can't find #{p} PSI set (and assess if it's 'complete') - skipping")
      return false
    end
    holes = []
    holes << :head if @has[p][:head]
    holes << :sill if @has[p][:sill]
    holes << :jamb if @has[p][:jamb]
    ok = holes.size == 3
    ok = true if @has[p][:fenestration]
    return false unless ok
    corners = []
    corners << :concave if @has[p][:cornerconcave]
    corners << :convex  if @has[p][:cornerconvex]
    ok = corners.size == 2
    ok = true if @has[p][:corner]
    return false unless ok
    parapets = []
    parapets << :concave if @has[p][:parapetconcave]
    parapets << :convex  if @has[p][:parapetconvex]
    ok = parapets.size == 2
    ok = true if @has[p][:parapet]
    return false unless ok
    return false unless @has[p][:party]
    return false unless @has[p][:grade]
    return false unless @has[p][:balcony]
    return false unless @has[p][:rimjoist]
    ok
  end
def complete? ( p ) unless @set . has_key? ( p ) && @has . has_key? ( p ) && @val . has_key? ( p ) TBD . log ( TBD :: ERROR , "Can't find #{p} PSI set (and assess if it's 'complete') - skipping" ) return false end holes = [ ] holes << :head if @has [ p ] [ :head ] holes << :sill if @has [ p ] [ :sill ] holes << :jamb if @has [ p ] [ :jamb ] ok = holes . size == 3 ok = true if @has [ p ] [ :fenestration ] return false unless ok corners = [ ] corners << :concave if @has [ p ] [ :cornerconcave ] corners << :convex if @has [ p ] [ :cornerconvex ] ok = corners . size == 2 ok = true if @has [ p ] [ :corner ] return false unless ok parapets = [ ] parapets << :concave if @has [ p ] [ :parapetconcave ] parapets << :convex if @has [ p ] [ :parapetconvex ] ok = parapets . size == 2 ok = true if @has [ p ] [ :parapet ] return false unless ok return false unless @has [ p ] [ :party ] return false unless @has [ p ] [ :grade ] return false unless @has [ p ] [ :balcony ] return false unless @has [ p ] [ :rimjoist ] ok end
Validate whether a stored PSI set has a complete list of PSI type:values
Validate whether a stored PSI set has a complete list of PSI type : values
Returns true if stored and has a complete PSI set
Returns true if stored and has a complete PSI set
Bool
p
p A PSI set identifier
p A PSI set identifier