Class: HeatingEnvironment

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Serialization
Defined in:
app/models/heating_environment.rb

Overview

A high-level environment a heating system can be installed into
(e.g. "indoor floor", "outdoor snow melt", "roof deicing") that maps
the public-facing environment name onto its key and the canonical
product-line URL the public site routes the visitor to.

Backed by the static lookup at
HeatingElementProductLineOption::PUBLIC_ENVIRONMENTS_HASH.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(environment_name) ⇒ HeatingEnvironment

Returns a new instance of HeatingEnvironment.



14
15
16
17
18
19
20
21
22
23
# File 'app/models/heating_environment.rb', line 14

def initialize(environment_name)
  if (env_hash = HeatingElementProductLineOption::PUBLIC_ENVIRONMENTS_HASH[environment_name]).present?
    @name = environment_name
    @key = env_hash[:key]
    @base_product_line_url = env_hash[:base_product_line_url]
    true
  else
    false
  end
end

Instance Attribute Details

#base_product_line_urlObject (readonly)

Returns the value of attribute base_product_line_url.



12
13
14
# File 'app/models/heating_environment.rb', line 12

def base_product_line_url
  @base_product_line_url
end

#keyObject (readonly)

Returns the value of attribute key.



12
13
14
# File 'app/models/heating_environment.rb', line 12

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'app/models/heating_environment.rb', line 12

def name
  @name
end