Class: OSMArg

Inherits:
Object
  • Object
show all
Defined in:
lib/openstudio-standards/btap/measures.rb

Constant Summary collapse

ARGUMENT_TYPES =
[
  "BOOL",         
  "STRING",       
  "INTEGER",      
  "FLOAT",        
  "STRINGCHOICE",
  "WSCHOICE"     
]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, variable_name, display_name, required) ⇒ OSMArg

Returns a new instance of OSMArg.



97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/openstudio-standards/btap/measures.rb', line 97

def initialize( type, variable_name, display_name, required )
  self.type = type
  self.variable_name = variable_name
  self.display_name = display_name
  self.required = required
  self.model_dependant = false
  if self.type == "WSCHOICE"
    self.model_dependant = true
  else
    self.model_dependant = false
  end
  return self
end

Instance Attribute Details

#default_valueObject

Returns the value of attribute default_value.



37
38
39
# File 'lib/openstudio-standards/btap/measures.rb', line 37

def default_value
  @default_value
end

#display_nameObject

Returns the value of attribute display_name.



37
38
39
# File 'lib/openstudio-standards/btap/measures.rb', line 37

def display_name
  @display_name
end

#max_valueObject

Returns the value of attribute max_value.



37
38
39
# File 'lib/openstudio-standards/btap/measures.rb', line 37

def max_value
  @max_value
end

#min_valueObject

Returns the value of attribute min_value.



37
38
39
# File 'lib/openstudio-standards/btap/measures.rb', line 37

def min_value
  @min_value
end

#model_dependantObject

Returns the value of attribute model_dependant.



37
38
39
# File 'lib/openstudio-standards/btap/measures.rb', line 37

def model_dependant
  @model_dependant
end

#os_object_typeObject

Returns the value of attribute os_object_type.



37
38
39
# File 'lib/openstudio-standards/btap/measures.rb', line 37

def os_object_type
  @os_object_type
end

#requiredObject

Returns the value of attribute required.



37
38
39
# File 'lib/openstudio-standards/btap/measures.rb', line 37

def required
  @required
end

#runnerObject

Returns the value of attribute runner.



37
38
39
# File 'lib/openstudio-standards/btap/measures.rb', line 37

def runner
  @runner
end

#string_choice_arrayObject

Returns the value of attribute string_choice_array.



37
38
39
# File 'lib/openstudio-standards/btap/measures.rb', line 37

def string_choice_array
  @string_choice_array
end

#typeObject

Returns the value of attribute type.



37
38
39
# File 'lib/openstudio-standards/btap/measures.rb', line 37

def type
  @type
end

#variable_nameObject

Returns the value of attribute variable_name.



37
38
39
# File 'lib/openstudio-standards/btap/measures.rb', line 37

def variable_name
  @variable_name
end

Class Method Details

.bool(variable_name, display_name, required, default_value) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/openstudio-standards/btap/measures.rb', line 49

def self.bool( variable_name,display_name,required,default_value )
  raise "#{default_value} defaut value is not a bool." unless default_value.is_a?(Bool)
  default_value.respond_to?(:to_s)
  arg = OSMArg.new( "BOOL", variable_name, display_name, required)
  arg.default_value = default_value
  return arg
end

.choice(variable_name, display_name, required, default_value, string_choice_array) ⇒ Object



82
83
84
85
86
87
88
# File 'lib/openstudio-standards/btap/measures.rb', line 82

def self.choice(variable_name,display_name,required,default_value,string_choice_array)
  raise "#{default_value} defaut value is not an array." unless default_value.is_a?(Array)    
  arg = OSMArg.new( "STRINGCHOICE", variable_name, display_name, required)
  arg.default_value = default_value
  arg.string_choice_array = string_choice_array
  return arg
end

.float(variable_name, display_name, required, default_value, min_value, max_value) ⇒ Object



73
74
75
76
77
78
79
80
# File 'lib/openstudio-standards/btap/measures.rb', line 73

def self.float( variable_name, display_name, required,default_value,min_value, max_value )
  raise "#{default_value} defaut value is not a float." unless default_value.respond_to?(:to_f)
  arg = OSMArg.new( "INTEGER", variable_name, display_name, required)
  arg.default_value = default_value
  arg.min_value = min_value
  arg.max_value = max_value
  return arg          
end

.integer(variable_name, display_name, required, default_value, min_value, max_value) ⇒ Object



64
65
66
67
68
69
70
71
# File 'lib/openstudio-standards/btap/measures.rb', line 64

def self.integer( variable_name,display_name,required,default_value,min_value,max_value )
  raise "#{default_value} defaut value is not a integer." unless default_value.respond_to?(:to_i)
  arg = OSMArg.new( "INTEGER", variable_name, display_name, required)
  arg.default_value = default_value
  arg.min_value = min_value
  arg.max_value = max_value
  return arg          
end

.string(variable_name, display_name, required, default_value) ⇒ Object



57
58
59
60
61
62
# File 'lib/openstudio-standards/btap/measures.rb', line 57

def self.string( variable_name,display_name,required,default_value )
  raise "#{default_value} defaut value is not a string." unless default_value.respond_to?(:to_s)
  arg = OSMArg.new( "STRING", variable_name, display_name, required)
  arg.default_value = default_value
  return arg
end

.wschoice(variable_name, display_name, required, default_value, os_object_type) ⇒ Object



90
91
92
93
94
95
# File 'lib/openstudio-standards/btap/measures.rb', line 90

def self.wschoice( variable_name, display_name, required, default_value, os_object_type)
  arg = OSMArg.new( "WSCHOICE", variable_name, display_name, required )
  arg.default_value = default_value
  arg.os_object_type = os_object_type
  return arg          
end