Class: ActionView::Resolver::Path

Inherits:
Object
  • Object
show all
Defined in:
actionview/lib/action_view/template/resolver.rb

Overview

Keeps all information about view path and builds virtual path.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, prefix, partial, virtual) ⇒ Path

Returns a new instance of Path.



23
24
25
26
27
28
# File 'actionview/lib/action_view/template/resolver.rb', line 23

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name



13
14
15
# File 'actionview/lib/action_view/template/resolver.rb', line 13

def name
  @name
end

#partialObject (readonly) Also known as: partial?

Returns the value of attribute partial



13
14
15
# File 'actionview/lib/action_view/template/resolver.rb', line 13

def partial
  @partial
end

#prefixObject (readonly)

Returns the value of attribute prefix



13
14
15
# File 'actionview/lib/action_view/template/resolver.rb', line 13

def prefix
  @prefix
end

#virtualObject (readonly)

Returns the value of attribute virtual



13
14
15
# File 'actionview/lib/action_view/template/resolver.rb', line 13

def virtual
  @virtual
end

Class Method Details

.build(name, prefix, partial) ⇒ Object



16
17
18
19
20
21
# File 'actionview/lib/action_view/template/resolver.rb', line 16

def self.build(name, prefix, partial)
  virtual = ""
  virtual << "#{prefix}/" unless prefix.empty?
  virtual << (partial ? "_#{name}" : name)
  new name, prefix, partial, virtual
end

Instance Method Details

#to_strObject Also known as: to_s



30
31
32
# File 'actionview/lib/action_view/template/resolver.rb', line 30

def to_str
  @virtual
end