Class: RequestVariable
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- RequestVariable
- Defined in:
- app/models/request_variable.rb
Instance Method Summary collapse
- #attached? ⇒ Boolean
- #attached_variable_pointer_mnemonic ⇒ Object
- #categories ⇒ Object
- #data_type ⇒ Object
- #detailed? ⇒ Boolean
- #full_label ⇒ Object
- #general? ⇒ Boolean
- #household_variable? ⇒ Boolean
- #long_mnemonic ⇒ Object
-
#mnemonic ⇒ Object
Convenience methods: The mnemonic of a request variable can be constructed from the requested variable but will be different if it’s an attached variable (variable.mnemonic + attached_pointer suffix.).
- #person_variable? ⇒ Boolean
- #record_type ⇒ Object
- #start ⇒ Object
- #start=(s) ⇒ Object
- #width ⇒ Object
- #width=(w) ⇒ Object
Instance Method Details
#attached? ⇒ Boolean
29 30 31 |
# File 'app/models/request_variable.rb', line 29 def attached? !attached_variable_pointer.nil? end |
#attached_variable_pointer_mnemonic ⇒ Object
33 34 35 |
# File 'app/models/request_variable.rb', line 33 def attached_variable_pointer_mnemonic attached? ? attached_variable_pointer.mnemonic : nil end |
#categories ⇒ Object
76 77 78 79 80 81 82 |
# File 'app/models/request_variable.rb', line 76 def categories if general? variable.general_categories else variable.detailed_categories end end |
#data_type ⇒ Object
25 26 27 |
# File 'app/models/request_variable.rb', line 25 def data_type variable.data_type end |
#detailed? ⇒ Boolean
17 18 19 |
# File 'app/models/request_variable.rb', line 17 def detailed? general_detailed_selection == 'D' end |
#full_label ⇒ Object
72 73 74 |
# File 'app/models/request_variable.rb', line 72 def full_label attached_variable_pointer ? label_for_attached : label_for_non_attached end |
#general? ⇒ Boolean
13 14 15 |
# File 'app/models/request_variable.rb', line 13 def general? general_detailed_selection == 'G' end |
#household_variable? ⇒ Boolean
37 38 39 |
# File 'app/models/request_variable.rb', line 37 def household_variable? variable.household_variable? end |
#long_mnemonic ⇒ Object
61 62 63 64 65 66 67 68 69 70 |
# File 'app/models/request_variable.rb', line 61 def long_mnemonic mnemonic = variable.long_mnemonic if detailed? mnemonic += "D" end unless attached_variable_pointer.nil? mnemonic += "_" + attached_variable_pointer.suffix end mnemonic end |
#mnemonic ⇒ Object
Convenience methods: The mnemonic of a request variable can be constructed from the requested variable but will be different if it’s an attached variable (variable.mnemonic + attached_pointer suffix.)
9 10 11 |
# File 'app/models/request_variable.rb', line 9 def mnemonic attached_variable_pointer ? variable.mnemonic + "_" + attached_variable_pointer.suffix : variable.mnemonic end |
#person_variable? ⇒ Boolean
41 42 43 |
# File 'app/models/request_variable.rb', line 41 def person_variable? variable.person_variable? end |
#record_type ⇒ Object
21 22 23 |
# File 'app/models/request_variable.rb', line 21 def record_type variable.record_type end |
#start ⇒ Object
49 50 51 |
# File 'app/models/request_variable.rb', line 49 def start @computed_start || variable.start end |
#start=(s) ⇒ Object
53 54 55 |
# File 'app/models/request_variable.rb', line 53 def start=(s) @computed_start = s end |
#width ⇒ Object
45 46 47 |
# File 'app/models/request_variable.rb', line 45 def width @computed_width || variable.width end |
#width=(w) ⇒ Object
57 58 59 |
# File 'app/models/request_variable.rb', line 57 def width=(w) @computed_width = w end |