Class: RbsActiverecord::Generator::ActiveStorage::InstanceMethods

Inherits:
Object
  • Object
show all
Defined in:
lib/rbs_activerecord/generator/active_storage/instance_methods.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ InstanceMethods

Returns a new instance of InstanceMethods.



10
11
12
# File 'lib/rbs_activerecord/generator/active_storage/instance_methods.rb', line 10

def initialize(model) #: void
  @model = model
end

Instance Attribute Details

#modelObject (readonly)

: RbsActiverecord::Model



7
8
9
# File 'lib/rbs_activerecord/generator/active_storage/instance_methods.rb', line 7

def model
  @model
end

Instance Method Details

#generateObject

: String



14
15
16
17
18
19
20
# File 'lib/rbs_activerecord/generator/active_storage/instance_methods.rb', line 14

def generate #: String
  <<~RBS.strip
    module GeneratedActiveStorageInstanceMethods
      #{attachments.map { |name, reflection| attachment(name, reflection) }.join("\n")}
    end
  RBS
end