Class: AppEngine::Rack::Resources
- Inherits:
-
Object
- Object
- AppEngine::Rack::Resources
- Defined in:
- lib/appengine-rack.rb
Constant Summary collapse
- COMMON_EXCLUDES =
{ :rails_excludes => %w(README Rakefile db/** doc/** bin/** log/** script/** test/** tmp/**), :merb_excludes => %w(Rakefile autotest/** doc/** bin/** gems/** spec/**) }
Instance Method Summary collapse
- #append_to(xml, type) ⇒ Object
- #exclude(glob) ⇒ Object
- #include(glob, expiration = nil) ⇒ Object
-
#initialize ⇒ Resources
constructor
A new instance of Resources.
Constructor Details
#initialize ⇒ Resources
Returns a new instance of Resources.
49 50 51 52 |
# File 'lib/appengine-rack.rb', line 49 def initialize @includes = [] @excludes = [] end |
Instance Method Details
#append_to(xml, type) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/appengine-rack.rb', line 74 def append_to(xml, type) resources = xml.add_element(type) @includes.each do |path, expiration| element = resources.add_element('include') element.add_attribute('path', path) element.add_attribute('expiration', expiration) if expiration end @excludes.each do |path| resources.add_element('exclude').add_attribute('path', path) end end |
#exclude(glob) ⇒ Object
64 65 66 67 68 69 70 71 72 |
# File 'lib/appengine-rack.rb', line 64 def exclude(glob) if glob.is_a? Array @excludes += glob elsif glob.is_a? Symbol @excludes += COMMON_EXCLUDES[glob] else @excludes << glob end end |
#include(glob, expiration = nil) ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/appengine-rack.rb', line 54 def include(glob, expiration=nil) if glob.is_a? Array glob.each do |g| @includes << [g, expiration] end else @includes << [glob, expiration] end end |