Nested class?


#1

require ‘observer’
require ‘set’

class Content < ActiveRecord::Base
include Observable

#somecode here that I hidden

class ContentTextHelpers
include ActionView::Helpers::TagHelper
include ActionView::Helpers::SanitizeHelper
include ActionView::Helpers::TextHelper
end

+++++++++++++++++++++++

there’s a Content class nested ContentTextHelers class. I’m a litte
confused about that.
what’s nested class work for?
is only Ruby have nested class? like C++, is inherit class.


#2

Zhenning G. wrote:

require ‘observer’
require ‘set’

class Content < ActiveRecord::Base
include Observable

#somecode here that I hidden

class ContentTextHelpers
include ActionView::Helpers::TagHelper
include ActionView::Helpers::SanitizeHelper
include ActionView::Helpers::TextHelper
end

+++++++++++++++++++++++

there’s a Content class nested ContentTextHelers class. I’m a litte
confused about that.
what’s nested class work for?
is only Ruby have nested class? like C++, is inherit class.

ContentTextHelpers is the single class for Content class scope .
generally we can all classes are nested class of Object