Class: StructuredNoise::CLI
- Inherits:
-
Object
- Object
- StructuredNoise::CLI
- Defined in:
- lib/structured_noise/cli.rb
Instance Method Summary collapse
- #die_if_no_schema! ⇒ Object
-
#initialize(scriptname, args) ⇒ CLI
constructor
A new instance of CLI.
- #operating_environment ⇒ Object
- #run! ⇒ Object
Constructor Details
#initialize(scriptname, args) ⇒ CLI
Returns a new instance of CLI.
3 4 5 |
# File 'lib/structured_noise/cli.rb', line 3 def initialize(scriptname, args) @options = StructuredNoise::Options.new(scriptname, args) end |
Instance Method Details
#die_if_no_schema! ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/structured_noise/cli.rb', line 23 def die_if_no_schema! unless @options.schema puts "Please define a schema." puts "" puts @options.parser exit end end |
#operating_environment ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/structured_noise/cli.rb', line 14 def @operating_environment ||= StructuredNoise::Generator.new( schema: @options.schema, base64: @options.base64, messages_per_second: @options. ) end |
#run! ⇒ Object
7 8 9 10 11 12 |
# File 'lib/structured_noise/cli.rb', line 7 def run! die_if_no_schema! .load_schema .generate_output end |