Module: Statsample::NamedMatrix

Includes:
Summarizable
Included in:
CovariateMatrix
Defined in:
lib/statsample/matrix.rb

Overview

Module to add names to X and Y fields

Instance Method Summary collapse

Methods included from Summarizable

#summary

Instance Method Details

#fieldsObject



179
180
181
182
# File 'lib/statsample/matrix.rb', line 179

def fields
raise "Should be square" if !square?
fields_x
end

#fields=(v) ⇒ Object



183
184
185
186
187
# File 'lib/statsample/matrix.rb', line 183

def fields=(v)
raise "Matrix should be square" if !square?
@fields_x=v
@fields_y=v
end

#fields_xObject



196
197
198
# File 'lib/statsample/matrix.rb', line 196

def fields_x
@fields_x||=row_size.times.collect {|i| _("X%d") % i}
end

#fields_x=(v) ⇒ Object



188
189
190
191
# File 'lib/statsample/matrix.rb', line 188

def fields_x=(v)
raise "Size of fields != row_size" if v.size!=row_size
@fields_x=v
end

#fields_yObject



199
200
201
# File 'lib/statsample/matrix.rb', line 199

def fields_y
@fields_y||=column_size.times.collect {|i| _("Y%d") % i}
end

#fields_y=(v) ⇒ Object



192
193
194
195
# File 'lib/statsample/matrix.rb', line 192

def fields_y=(v)
raise "Size of fields != column_size" if v.size!=column_size
@fields_y=v
end

#get_new_nameObject



209
210
211
212
213
# File 'lib/statsample/matrix.rb', line 209

def get_new_name
  @@named_matrix||=0
  @@named_matrix+=1
  _("Matrix %d") % @@named_matrix
end

#nameObject



203
204
205
# File 'lib/statsample/matrix.rb', line 203

def name
  @name||=get_new_name
end

#name=(v) ⇒ Object



206
207
208
# File 'lib/statsample/matrix.rb', line 206

def name=(v)
  @name=v
end