Class: JsonSchema::Faker
- Inherits:
-
Object
- Object
- JsonSchema::Faker
- Defined in:
- lib/json_schema/faker.rb,
lib/json_schema/faker/util.rb,
lib/json_schema/faker/formats.rb
Defined Under Namespace
Modules: Configuration, Formats, Strategy, Util
Instance Method Summary collapse
- #generate(hint: nil) ⇒ Object
-
#initialize(schema, options = {}) ⇒ Faker
constructor
A new instance of Faker.
Constructor Details
#initialize(schema, options = {}) ⇒ Faker
Returns a new instance of Faker.
17 18 19 20 |
# File 'lib/json_schema/faker.rb', line 17 def initialize(schema, = {}) @schema = schema @options = end |
Instance Method Details
#generate(hint: nil) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/json_schema/faker.rb', line 22 def generate(hint: nil) strategy = @options[:strategy] || Strategy::Simple.new Configuration.logger.debug "to generate against #{@schema.inspect_schema}" if Configuration.logger generated = strategy.call(@schema, hint: hint, position: "") Configuration.logger.debug "generated: #{generated.inspect}" if Configuration.logger generated end |