Sha256: 8778b1b78faa59f5fddb22eeb4dd96452412ec23ffd428dd5b7a836cdd8f9d40

Contents?: true

Size: 736 Bytes

Versions: 1

Compression:

Stored size: 736 Bytes

Contents

require 'pathname'

require 'skippy/library'

class Skippy::LibModule

  attr_reader :path

  class ModuleNotFoundError < Skippy::Error; end

  # @param [String] path
  def initialize(path)
    @path = Pathname.new(path)
    raise ModuleNotFoundError, @path.to_s unless @path.file?
  end

  # @param [String]
  def basename
    path.basename('.*').to_s
  end

  # @return [Skippy::Library]
  def library
    Skippy::Library.new(library_path)
  end

  # @param [String]
  def name
    "#{library_name}/#{basename}"
  end

  # @param [String]
  def to_s
    name
  end

  private

  def library_name
    library_path.basename.to_s
  end

  def library_path
    path.parent.parent
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
skippy-0.2.0.a lib/skippy/lib_module.rb