Class: RbsDraper::Decoratable::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/rbs_draper/decoratable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Generator

Returns a new instance of Generator.



22
23
24
25
# File 'lib/rbs_draper/decoratable.rb', line 22

def initialize(klass)
  @klass = klass
  @klass_name = klass.name || ""
end

Instance Attribute Details

#klassObject (readonly)

Returns the value of attribute klass.



20
21
22
# File 'lib/rbs_draper/decoratable.rb', line 20

def klass
  @klass
end

#klass_nameObject (readonly)

Returns the value of attribute klass_name.



20
21
22
# File 'lib/rbs_draper/decoratable.rb', line 20

def klass_name
  @klass_name
end

Instance Method Details

#generateObject



27
28
29
30
31
32
33
# File 'lib/rbs_draper/decoratable.rb', line 27

def generate
  format <<~RBS
    #{header}
    #{method_decls}
    #{footer}
  RBS
end