Class: RbsActionmailer::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/rbs_actionmailer/generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Generator

Returns a new instance of Generator.



13
14
15
16
# File 'lib/rbs_actionmailer/generator.rb', line 13

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

Instance Attribute Details

#declObject (readonly)

: RBS::Inline::AST::Declarations::ClassDecl | RBS::Inline::AST::Declarations::ModuleDecl | nil



10
11
12
# File 'lib/rbs_actionmailer/generator.rb', line 10

def decl
  @decl
end

#klassObject (readonly)

: singleton(ActionMailer::Base)



8
9
10
# File 'lib/rbs_actionmailer/generator.rb', line 8

def klass
  @klass
end

#klass_nameObject (readonly)

: String



9
10
11
# File 'lib/rbs_actionmailer/generator.rb', line 9

def klass_name
  @klass_name
end

Instance Method Details

#generateObject

: String



18
19
20
21
22
23
24
25
26
# File 'lib/rbs_actionmailer/generator.rb', line 18

def generate #: String
  @decl = Parser.parse(klass_name)

  format <<~RBS
    #{header}
    #{methods}
    #{footer}
  RBS
end