Class: RailsBestPractices::Core::Klass

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_best_practices/core/klasses.rb

Overview

Class info includes clas name, extend class name and module names.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(class_name, extend_class_name, modules) ⇒ Klass

Returns a new instance of Klass.



19
20
21
22
23
# File 'lib/rails_best_practices/core/klasses.rb', line 19

def initialize(class_name, extend_class_name, modules)
  @class_name = class_name
  @extend_class_name = extend_class_name
  @modules = modules.dup
end

Instance Attribute Details

#class_nameObject (readonly)

Returns the value of attribute class_name.



17
18
19
# File 'lib/rails_best_practices/core/klasses.rb', line 17

def class_name
  @class_name
end

#extend_class_nameObject (readonly)

Returns the value of attribute extend_class_name.



17
18
19
# File 'lib/rails_best_practices/core/klasses.rb', line 17

def extend_class_name
  @extend_class_name
end

Instance Method Details

#to_sObject



25
26
27
28
29
30
31
# File 'lib/rails_best_practices/core/klasses.rb', line 25

def to_s
  if @modules.empty?
    @class_name
  else
    @modules.map { |modu| "#{modu}::" }.join("") + @class_name
  end
end