]> git.openstreetmap.org Git - chef.git/blob - cookbooks/tools/libraries/content_from_file.rb
Fix redirect of http://www.openstreetmap.org.uk/events.ics
[chef.git] / cookbooks / tools / libraries / content_from_file.rb
1 class Chef
2   class Resource
3     class File
4       def content_from_file(file, &block)
5         @content_file = file
6         @content_block = block
7       end
8
9       def content(text = nil)
10         if text
11           @content = text
12         elsif @content
13           @content
14         elsif @content_file
15           ::File.new(@content_file).collect do |line|
16             line = @content_block.call(line)
17           end.join("")
18         end
19       end
20     end
21   end
22 end