Class: ActiveMocker::FilePathToRubyClass
- Inherits:
-
Object
- Object
- ActiveMocker::FilePathToRubyClass
- Defined in:
- lib/active_mocker/file_path_to_ruby_class.rb
Instance Attribute Summary collapse
-
#base_path ⇒ Object
readonly
Returns the value of attribute base_path.
-
#class_path ⇒ Object
readonly
Returns the value of attribute class_path.
Instance Method Summary collapse
-
#initialize(base_path:, class_path:) ⇒ FilePathToRubyClass
constructor
A new instance of FilePathToRubyClass.
- #to_s ⇒ Object
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_path ⇒ Object (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_path ⇒ Object (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_s ⇒ Object
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 |