Class: CMSBinding::Article
Instance Attribute Summary collapse
-
#attachments ⇒ Object
readonly
Returns the value of attribute attachments.
-
#categoryID ⇒ Object
readonly
Returns the value of attribute categoryID.
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#headline ⇒ Object
readonly
Returns the value of attribute headline.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#keywords ⇒ Object
readonly
Returns the value of attribute keywords.
-
#large_intro ⇒ Object
readonly
Returns the value of attribute large_intro.
-
#small_intro ⇒ Object
readonly
Returns the value of attribute small_intro.
Instance Method Summary collapse
-
#initialize(article, source, partial) ⇒ Article
constructor
A new instance of Article.
Methods inherited from Base
Constructor Details
#initialize(article, source, partial) ⇒ Article
Returns a new instance of Article.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/twm-cms-bindings.rb', line 84 def initialize (article, source, partial) @source = source @attachments = [] @fields = {} @partial = partial @id = article.attributes['id'].to_str @headline = get_text( REXML::XPath.first( article, "headline" ) ) if( partial == false ) @categoryID = REXML::XPath.first( article, "category" ).attributes['id'].to_str @small_intro = get_text( REXML::XPath.first( article, "smallintro" ) ) @large_intro = get_text( REXML::XPath.first( article, "largeintro" ) ) @contents = get_text( REXML::XPath.first( article, "body" ) ) @keywords = get_text( REXML::XPath.first( article, "keywords" ) ).split(',') @date = get_text( REXML::XPath.first( article, "date" ) ) REXML::XPath.each( article, "field") {|field| key = field.attributes['name'].to_s value = get_text( REXML::XPath.first( field, ".")) @fields[key.strip] = value.strip } REXML::XPath.each( article, "attachments/attachment" ) {|| @attachments << CMSBinding::ArticleAttachment.new(, @source) } end end |
Instance Attribute Details
#attachments ⇒ Object (readonly)
Returns the value of attribute attachments.
81 82 83 |
# File 'lib/twm-cms-bindings.rb', line 81 def @attachments end |
#categoryID ⇒ Object (readonly)
Returns the value of attribute categoryID.
81 82 83 |
# File 'lib/twm-cms-bindings.rb', line 81 def categoryID @categoryID end |
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
81 82 83 |
# File 'lib/twm-cms-bindings.rb', line 81 def contents @contents end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
81 82 83 |
# File 'lib/twm-cms-bindings.rb', line 81 def date @date end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
81 82 83 |
# File 'lib/twm-cms-bindings.rb', line 81 def fields @fields end |
#headline ⇒ Object (readonly)
Returns the value of attribute headline.
81 82 83 |
# File 'lib/twm-cms-bindings.rb', line 81 def headline @headline end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
81 82 83 |
# File 'lib/twm-cms-bindings.rb', line 81 def id @id end |
#keywords ⇒ Object (readonly)
Returns the value of attribute keywords.
81 82 83 |
# File 'lib/twm-cms-bindings.rb', line 81 def keywords @keywords end |
#large_intro ⇒ Object (readonly)
Returns the value of attribute large_intro.
81 82 83 |
# File 'lib/twm-cms-bindings.rb', line 81 def large_intro @large_intro end |
#small_intro ⇒ Object (readonly)
Returns the value of attribute small_intro.
81 82 83 |
# File 'lib/twm-cms-bindings.rb', line 81 def small_intro @small_intro end |