Class: RbsDraper::Decorator::Generator
- Inherits:
-
Object
- Object
- RbsDraper::Decorator::Generator
- Defined in:
- lib/rbs_draper/decorator.rb
Instance Attribute Summary collapse
-
#decorated_class ⇒ Object
readonly
Returns the value of attribute decorated_class.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#klass_name ⇒ Object
readonly
Returns the value of attribute klass_name.
-
#rbs_builder ⇒ Object
readonly
Returns the value of attribute rbs_builder.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(klass, rbs_builder, decorated_class: nil) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(klass, rbs_builder, decorated_class: nil) ⇒ Generator
Returns a new instance of Generator.
15 16 17 18 19 20 |
# File 'lib/rbs_draper/decorator.rb', line 15 def initialize(klass, rbs_builder, decorated_class: nil) @klass = klass @klass_name = klass.name || "" @rbs_builder = rbs_builder @decorated_class = decorated_class end |
Instance Attribute Details
#decorated_class ⇒ Object (readonly)
Returns the value of attribute decorated_class.
13 14 15 |
# File 'lib/rbs_draper/decorator.rb', line 13 def decorated_class @decorated_class end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
13 14 15 |
# File 'lib/rbs_draper/decorator.rb', line 13 def klass @klass end |
#klass_name ⇒ Object (readonly)
Returns the value of attribute klass_name.
13 14 15 |
# File 'lib/rbs_draper/decorator.rb', line 13 def klass_name @klass_name end |
#rbs_builder ⇒ Object (readonly)
Returns the value of attribute rbs_builder.
13 14 15 |
# File 'lib/rbs_draper/decorator.rb', line 13 def rbs_builder @rbs_builder end |
Instance Method Details
#generate ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rbs_draper/decorator.rb', line 22 def generate return if decorated_class_def.blank? format <<~RBS #{header} #{mixin_decls} #{class_method_decls} #{object_method_decls} #{method_decls} #{} RBS end |