Class: ActiveMocker::FilePathToRubyClass

Inherits:
Object
  • Object
show all
Defined in:
lib/active_mocker/file_path_to_ruby_class.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_path:, class_path:) ⇒ FilePathToRubyClass

Returns a new instance of FilePathToRubyClass.



6
7
8
9
# File 'lib/active_mocker/file_path_to_ruby_class.rb', line 6

def initialize(base_path:, class_path:)
  @base_path  = base_path
  @class_path = class_path
end

Instance Attribute Details

#base_pathObject (readonly)

Returns the value of attribute base_path.



4
5
6
# File 'lib/active_mocker/file_path_to_ruby_class.rb', line 4

def base_path
  @base_path
end

#class_pathObject (readonly)

Returns the value of attribute class_path.



4
5
6
# File 'lib/active_mocker/file_path_to_ruby_class.rb', line 4

def class_path
  @class_path
end

Instance Method Details

#to_sObject



11
12
13
# File 'lib/active_mocker/file_path_to_ruby_class.rb', line 11

def to_s
  File.basename((class_path.gsub(base_path + "/", "")).split("/").map(&:camelize).join("::"), '.rb')
end