Module: Statsample::NamedMatrix
Overview
Module to add names to X and Y fields
Instance Method Summary collapse
- #fields ⇒ Object
- #fields=(v) ⇒ Object
- #fields_x ⇒ Object
- #fields_x=(v) ⇒ Object
- #fields_y ⇒ Object
- #fields_y=(v) ⇒ Object
- #get_new_name ⇒ Object
- #name ⇒ Object
- #name=(v) ⇒ Object
Methods included from Summarizable
Instance Method Details
#fields ⇒ Object
181 182 183 184 |
# File 'lib/statsample/matrix.rb', line 181 def fields raise "Should be square" if !square? fields_x end |
#fields=(v) ⇒ Object
185 186 187 188 189 |
# File 'lib/statsample/matrix.rb', line 185 def fields=(v) raise "Matrix should be square" if !square? @fields_x=v @fields_y=v end |
#fields_x ⇒ Object
198 199 200 |
# File 'lib/statsample/matrix.rb', line 198 def fields_x @fields_x||=row_size.times.collect {|i| _("X%d") % i} end |
#fields_x=(v) ⇒ Object
190 191 192 193 |
# File 'lib/statsample/matrix.rb', line 190 def fields_x=(v) raise "Size of fields != row_size" if v.size!=row_size @fields_x=v end |
#fields_y ⇒ Object
201 202 203 |
# File 'lib/statsample/matrix.rb', line 201 def fields_y @fields_y||=column_size.times.collect {|i| _("Y%d") % i} end |
#fields_y=(v) ⇒ Object
194 195 196 197 |
# File 'lib/statsample/matrix.rb', line 194 def fields_y=(v) raise "Size of fields != column_size" if v.size!=column_size @fields_y=v end |
#get_new_name ⇒ Object
211 212 213 214 215 |
# File 'lib/statsample/matrix.rb', line 211 def get_new_name @@named_matrix||=0 @@named_matrix+=1 _("Matrix %d") % @@named_matrix end |
#name ⇒ Object
205 206 207 |
# File 'lib/statsample/matrix.rb', line 205 def name @name||=get_new_name end |
#name=(v) ⇒ Object
208 209 210 |
# File 'lib/statsample/matrix.rb', line 208 def name=(v) @name=v end |