class ActionView::TemplatePath

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/action_view/template_path.rbs

class ActionView::TemplatePath
  def self.build: (String name, String prefix, bool partial) -> ActionView::TemplatePath
  def self.virtual: (String name, String prefix, bool partial) -> String
end

partial arguments and the virtual path.
TemplatePath makes it convenient to convert between separate name, prefix,
like “users/show”
Represents a template path within ActionView’s lookup and rendering system,

def self.build(name, prefix, partial)

Experimental RBS support (using type sampling data from the type_fusion project).

def self.build: (String name, String prefix, bool partial) -> ActionView::TemplatePath

This signature was generated using 7 samples from 1 application.

Convert name, prefix, and partial into a TemplatePath
def self.build(name, prefix, partial)
  new name, prefix, partial, virtual(name, prefix, partial)
end

def self.parse(virtual)

Build a TemplatePath form a virtual path
def self.parse(virtual)
  if nameidx = virtual.rindex("/")
    prefix = virtual[0, nameidx]
    name = virtual.from(nameidx + 1)
    prefix = prefix[1..] if prefix.start_with?("/")
  else
    prefix = ""
    name = virtual
  end
  partial = name.start_with?("_")
  name = name[1..] if partial
  new name, prefix, partial, virtual
end

def self.virtual(name, prefix, partial)

Experimental RBS support (using type sampling data from the type_fusion project).

def self.virtual: (String name, String prefix, bool partial) -> String

This signature was generated using 33 samples from 2 applications.

Convert name, prefix, and partial into a virtual path string
def self.virtual(name, prefix, partial)
  if prefix.empty?
    "#{partial ? "_" : ""}#{name}"
  elsif partial
    "#{prefix}/_#{name}"
  else
    "#{prefix}/#{name}"
  end
end

def eql?(other) # :nodoc:

:nodoc:
def eql?(other) # :nodoc:
  @virtual == other.virtual
end

def hash # :nodoc:

:nodoc:
def hash # :nodoc:
  @virtual.hash
end

def initialize(name, prefix, partial, virtual)

def initialize(name, prefix, partial, virtual)
  @name    = name
  @prefix  = prefix
  @partial = partial
  @virtual = virtual
end