Class: Specificator::Generator
- Inherits:
-
Object
- Object
- Specificator::Generator
- Defined in:
- lib/specificator.rb
Constant Summary collapse
- WATERMARK =
" # Specificator"- EXPECTATIONS_TYPES =
%w(validations associations).freeze
Instance Attribute Summary collapse
-
#model_class ⇒ Object
Returns the value of attribute model_class.
Class Method Summary collapse
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(model_class) ⇒ Generator
constructor
A new instance of Generator.
- #valid? ⇒ Boolean
Constructor Details
#initialize(model_class) ⇒ Generator
Returns a new instance of Generator.
18 19 20 |
# File 'lib/specificator.rb', line 18 def initialize(model_class) @model_class = model_class end |
Instance Attribute Details
#model_class ⇒ Object
Returns the value of attribute model_class.
12 13 14 |
# File 'lib/specificator.rb', line 12 def model_class @model_class end |
Class Method Details
.generate_for(model_class) ⇒ Object
14 15 16 |
# File 'lib/specificator.rb', line 14 def self.generate_for(model_class) new(model_class).generate end |
Instance Method Details
#generate ⇒ Object
22 23 24 25 26 |
# File 'lib/specificator.rb', line 22 def generate return unless valid? prepare_model_specs! || update_model_specs! end |
#valid? ⇒ Boolean
28 29 30 |
# File 'lib/specificator.rb', line 28 def valid? model_class < ActiveRecord::Base end |