Class: Reactive::Mvc::View::PathSet

Inherits:
Array
  • Object
show all
Defined in:
lib/reactive-mvc/view/paths.rb

Overview

:nodoc:

Defined Under Namespace

Classes: Path

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ PathSet

Returns a new instance of PathSet.



18
19
20
# File 'lib/reactive-mvc/view/paths.rb', line 18

def initialize(*args)
  super(*args).map! { |obj| self.class.type_cast(obj) }
end

Class Method Details

.type_cast(obj) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/reactive-mvc/view/paths.rb', line 3

def self.type_cast(obj)
  if obj.is_a?(String)
    if Base.warn_cache_misses && defined?(Rails) && Rails.initialized?
      Base.logger.debug "[PERFORMANCE] Processing view path during a " +
        "request. This an expense disk operation that should be done at " +
        "boot. You can manually process this view path with " +
        "ActionView::Base.process_view_paths(#{obj.inspect}) and set it " +
        "as your view path"
    end
    Path.new(obj)
  else
    obj
  end
end

Instance Method Details

#<<(obj) ⇒ Object



22
23
24
# File 'lib/reactive-mvc/view/paths.rb', line 22

def <<(obj)
  super(self.class.type_cast(obj))
end

#[](template_path) ⇒ Object



116
117
118
119
120
121
122
123
# File 'lib/reactive-mvc/view/paths.rb', line 116

def [](template_path)
  each do |path|
    if template = path[template_path]
      return template
    end
  end
  nil
end

#concat(array) ⇒ Object



26
27
28
# File 'lib/reactive-mvc/view/paths.rb', line 26

def concat(array)
  super(array.map! { |obj| self.class.type_cast(obj) })
end

#insert(index, obj) ⇒ Object



30
31
32
# File 'lib/reactive-mvc/view/paths.rb', line 30

def insert(index, obj)
  super(index, self.class.type_cast(obj))
end

#loadObject



108
109
110
# File 'lib/reactive-mvc/view/paths.rb', line 108

def load
  each { |path| path.load }
end

#push(*objs) ⇒ Object



34
35
36
# File 'lib/reactive-mvc/view/paths.rb', line 34

def push(*objs)
  super(*objs.map { |obj| self.class.type_cast(obj) })
end

#reload!Object



112
113
114
# File 'lib/reactive-mvc/view/paths.rb', line 112

def reload!
  each { |path| path.reload! }
end

#unshift(*objs) ⇒ Object



38
39
40
# File 'lib/reactive-mvc/view/paths.rb', line 38

def unshift(*objs)
  super(*objs.map { |obj| self.class.type_cast(obj) })
end