Class: Literal::Attributable::Generators::Reader

Inherits:
Base
  • Object
show all
Defined in:
lib/literal/attributable/generators/reader.rb

Direct Known Subclasses

IVarReader, StructReader

Instance Attribute Summary

Attributes included from Nodes

#nodes

Instance Method Summary collapse

Methods inherited from Base

#call

Methods included from Nodes

node

Constructor Details

#initialize(attribute) ⇒ Reader

Returns a new instance of Reader.



5
6
7
# File 'lib/literal/attributable/generators/reader.rb', line 5

def initialize(attribute)
	@attribute = attribute
end

Instance Method Details

#templateObject



9
10
11
12
13
14
15
16
# File 'lib/literal/attributable/generators/reader.rb', line 9

def template
	Def.new(
		visibility: @attribute.reader,
		name: @attribute.name,
		params: nil,
		body:
	)
end