Class: Synthra::Types::TechnologyInternet::AppVersion

Inherits:
Base
  • Object
show all
Defined in:
lib/synthra/types/technology_internet/apps.rb

Overview

AppVersion type

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



57
58
59
# File 'lib/synthra/types/technology_internet/apps.rb', line 57

def generate_edge(rng, context, args)
  ["0.0.0", "10.99.999", "1.0.0"].sample(random: rng.instance_variable_get(:@random))
end

#generate_invalid(rng, context, args) ⇒ Object



61
62
63
# File 'lib/synthra/types/technology_internet/apps.rb', line 61

def generate_invalid(rng, context, args)
  [nil, "not a version", "invalid", [], {}].sample(random: rng.instance_variable_get(:@random))
end

#generate_random(rng, context, args) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/synthra/types/technology_internet/apps.rb', line 49

def generate_random(rng, context, args)
  # Semantic versioning: major.minor.patch
  major = rng.int(0, 10)
  minor = rng.int(0, 99)
  patch = rng.int(0, 999)
  "#{major}.#{minor}.#{patch}"
end