Rails 5 Code Reading Part 2 ~ Action View ~

    class RenderedTemplate # :nodoc:
      attr_reader :body, :template

      def initialize(body, template)
        @body = body
        @template = template
      end

      def format
        template.format
      end

      EMPTY_SPACER = Struct.new(:body).new
    end

Why is the template in the format method not @template and an instance variable?

Recommended Posts

Rails 5 Code Reading Part 2 ~ Action View ~
Rails 5 Code Reading Part 1 ~ ActiveRecord new Method ~
Ruby Gem Code Reading settings logic Part 1
Rails Docker ~ Part 1 ~
Rails Docker ~ Part 2 ~
[Rails] View sharing
Rails Action Text implementation
Rails learning day 2 part 2
Rails learning day 1 part 3
Rails learning day 3 part 2
Rails learning Day 1 Part 2
CRuby code reading (2): rb_newobj_of
Use Rails template function (ERB) other than Controller (Action View)
CRuby code reading (1): LIKELY / UNLIKELY
[Rails] Test code using Rspec
View monthly calendar in Rails
Rails routing controller view relationship
When reading the source code