Class: Codegen::Sources::Base
- Inherits:
-
Object
- Object
- Codegen::Sources::Base
- Includes:
- ActiveSupport::Callbacks
- Defined in:
- lib/codegen/sources/base.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
.convert_to ⇒ Object
Returns the value of attribute convert_to.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.convert_to ⇒ Object
Returns the value of attribute convert_to.
8 9 10 |
# File 'lib/codegen/sources/base.rb', line 8 def convert_to @convert_to end |
Class Method Details
.converts_to(type) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/codegen/sources/base.rb', line 11 def self.converts_to type if type.is_a? Symbol self.convert_to = type else self.convert_to = type.map { |t| t.to_s.underscore.to_sym } end end |
Instance Method Details
#check_valid(params) ⇒ Object
22 23 24 |
# File 'lib/codegen/sources/base.rb', line 22 def check_valid params self.convert_to.include? params[:type] end |
#convert! ⇒ Object
26 27 28 29 30 |
# File 'lib/codegen/sources/base.rb', line 26 def convert! run_callbacks :convert! do convert end end |