Class: Ecu::PropertyGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/ecu/labels/property_generator.rb

Constant Summary collapse

PREFIXES =
%w(PAR VEC MAT CRV MAP)
FCN1 =
%w(Ldp Dmc Dcr Wc Sns)
FCN2 =
%w(Pa Etf Btf Ca Tqz Msc Tqx Tqa Tqb)
TYPE =
%w(ww tqw st a ax cw b sx vx v r)
LOC =
%w(FL FR RL RR FA RA)
DESC =
%w(Foo Bar Baz Lala Hulu)
UNIT =
%w(Nm rad/s m s m/s^2 m/s -)

Class Method Summary collapse

Class Method Details

.descriptionObject



26
27
28
# File 'lib/ecu/labels/property_generator.rb', line 26

def self.description
  "foo bar"
end

.functionObject



22
23
24
# File 'lib/ecu/labels/property_generator.rb', line 22

def self.function
  FCN1.sample + FCN2.sample
end

.name(prefix: nil, suffix: "") ⇒ Object



11
12
13
14
15
16
# File 'lib/ecu/labels/property_generator.rb', line 11

def self.name(prefix: nil, suffix: "")
  (prefix || PREFIXES.sample) + "_" +
    FCN1.sample + FCN2.sample + "_" +
    TYPE.sample + (LOC + [""]).sample + "_" +
    DESC.sample + DESC.sample + suffix.to_s
end

.unitObject



18
19
20
# File 'lib/ecu/labels/property_generator.rb', line 18

def self.unit
  UNIT.sample
end

.value(numeric = true) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/ecu/labels/property_generator.rb', line 30

def self.value(numeric=true)
  if numeric
    rand(-1e3..1e3)
  else
    %w(true false).sample
  end
end