Class: Inforouter::FolderRule
- Inherits:
-
Object
- Object
- Inforouter::FolderRule
- Defined in:
- lib/inforouter/folder_rule.rb
Class Method Summary collapse
- .rule_itme(xml, name, value) ⇒ Object
-
.rules_xml(options = {}) ⇒ Object
The Rules XML fragment should be as described below.
Class Method Details
.rule_itme(xml, name, value) ⇒ Object
46 47 48 |
# File 'lib/inforouter/folder_rule.rb', line 46 def self.rule_itme(xml, name, value) xml.Rule(:Name => name, :Value => value) end |
.rules_xml(options = {}) ⇒ Object
The Rules XML fragment should be as described below. The Rule item that is not specified in the xml structure will not be updated. For the AllowableFileTypes set value attribute to comman delimited file extensions or set value to “*” for allowing all file types. <Rules>
<Rule Name="AllowableFileTypes" Value="BMP,DOC,JPG,XLS" />
<Rule Name="Checkins" Value="disallows" />
<Rule Name="Checkouts" Value="disallows" />
<Rule Name="DocumentDeletes" Value="disallows" />
<Rule Name="FolderDeletes" Value="disallows" />
<Rule Name="NewDocuments" Value="disallows" />
<Rule Name="NewFolders" Value="disallows" />
<Rule Name="ClassifiedDocuments" Value="allows" />
</Rules>
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/inforouter/folder_rule.rb', line 20 def self.rules_xml( = {}) = { :allowable_file_types => nil, :checkins => 'disallows', :checkouts => 'disallows', :document_deletes => 'disallows', :folder_deletes => 'disallows', :new_documents => 'disallows', :new_folders => 'disallows', :classified_documents => 'disallows' }.merge() builder = Nokogiri::XML::Builder.new do |xml| xml.Rules { rule_item(xml, 'AllowableFileTypes', [:allowable_file_types]) rule_item(xml, 'Checkins', [:checkins]) rule_item(xml, 'Checkouts', [:checkouts]) rule_item(xml, 'DocumentDeletes', [:document_deletes]) rule_item(xml, 'FolderDeletes', [:folder_deletes]) rule_item(xml, 'NewDocuments', [:new_documents]) rule_item(xml, 'NewFolders', [:new_folders]) rule_item(xml, 'ClassifiedDocuments', [:classified_documents]) } end builder.doc.root.to_xml end |