Class: Scms::PageOptions
- Inherits:
-
Object
- Object
- Scms::PageOptions
- Defined in:
- lib/scms/scms-pageoptions.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#handler ⇒ Object
Returns the value of attribute handler.
-
#keywords ⇒ Object
Returns the value of attribute keywords.
-
#name ⇒ Object
Returns the value of attribute name.
-
#resource ⇒ Object
Returns the value of attribute resource.
-
#template ⇒ Object
Returns the value of attribute template.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #getResource(website, resource) ⇒ Object
-
#initialize(name, website, pageconfig, siteConfig) ⇒ PageOptions
constructor
A new instance of PageOptions.
Constructor Details
#initialize(name, website, pageconfig, siteConfig) ⇒ PageOptions
Returns a new instance of PageOptions.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/scms/scms-pageoptions.rb', line 40 def initialize (name, website, pageconfig, siteConfig) @name = name @template = siteConfig["template"] @url = "#{name}.html" @title = name @keywords = "" @description = "" @resource = Hash.new @handler = nil if pageconfig != nil @template = pageconfig["template"] unless pageconfig["template"] == nil @url = "#{name}/index.html" if pageconfig["cleanurl"] == true @url = pageconfig["generate"] if pageconfig["generate"] != nil #depreciated @url = pageconfig["url"] if pageconfig["url"] != nil @title = pageconfig["title"] unless pageconfig["title"] == nil @keywords = pageconfig["keywords"] if pageconfig["keywords"] != nil @description = pageconfig["description"] if pageconfig["description"] != nil @handler = pageconfig["handler"] @resource = getResource(website, pageconfig["resource"]) end end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/scms/scms-pageoptions.rb', line 6 def description @description end |
#handler ⇒ Object
Returns the value of attribute handler.
6 7 8 |
# File 'lib/scms/scms-pageoptions.rb', line 6 def handler @handler end |
#keywords ⇒ Object
Returns the value of attribute keywords.
6 7 8 |
# File 'lib/scms/scms-pageoptions.rb', line 6 def keywords @keywords end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/scms/scms-pageoptions.rb', line 6 def name @name end |
#resource ⇒ Object
Returns the value of attribute resource.
6 7 8 |
# File 'lib/scms/scms-pageoptions.rb', line 6 def resource @resource end |
#template ⇒ Object
Returns the value of attribute template.
6 7 8 |
# File 'lib/scms/scms-pageoptions.rb', line 6 def template @template end |
#title ⇒ Object
Returns the value of attribute title.
6 7 8 |
# File 'lib/scms/scms-pageoptions.rb', line 6 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/scms/scms-pageoptions.rb', line 6 def url @url end |
Instance Method Details
#getResource(website, resource) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/scms/scms-pageoptions.rb', line 66 def getResource(website, resource) ymlresource = Hash.new if resource != nil resourcepath = File.join(website, resource) if File.exists?(resourcepath) #ScmsUtils.log( "_Resource found: #{pageOptions.resource}_" ) begin ymlresource = YAML.load_file(resourcepath) rescue Exception=>e ScmsUtils.errLog(e.) ScmsUtils.log(e.backtrace.inspect) end else ScmsUtils.errLog("Resource not found: #{resource}") ScmsUtils.writelog("::Resource not found #{resource}", website) ScmsUtils.writelog("type NUL > #{resourcepath}", website) end end return ymlresource end |