Class: FactoryBotGenerator::Base
- Inherits:
-
Object
- Object
- FactoryBotGenerator::Base
- Defined in:
- lib/factory_bot_generator.rb
Constant Summary collapse
- QUOTE_AROUND_VALUE_TYPES =
i[string date datetime text].freeze
- EXCLUDE_COLUMNS =
%w[created_at updated_at].freeze
- TEMPLATE_PATH =
File.join(File.dirname(__FILE__), 'factory_bot_generator.erb')
- TEMPLATE =
File.read(TEMPLATE_PATH)
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(record, options) ⇒ Base
constructor
A new instance of Base.
- #render ⇒ Object
Constructor Details
#initialize(record, options) ⇒ Base
Returns a new instance of Base.
16 17 18 19 |
# File 'lib/factory_bot_generator.rb', line 16 def initialize(record, ) @record = record = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
21 22 23 |
# File 'lib/factory_bot_generator.rb', line 21 def end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
21 22 23 |
# File 'lib/factory_bot_generator.rb', line 21 def record @record end |
Class Method Details
.render(record, options = {}) ⇒ Object
12 13 14 |
# File 'lib/factory_bot_generator.rb', line 12 def self.render(record, = {}) new(record, ).render end |
Instance Method Details
#render ⇒ Object
23 24 25 |
# File 'lib/factory_bot_generator.rb', line 23 def render ERB.new(TEMPLATE, trim_mode: '-').result(binding) end |