Class: Html2rss::SST::Attrs
- Inherits:
-
Data
- Object
- Data
- Html2rss::SST::Attrs
- Defined in:
- lib/html2rss/sst/attrs.rb
Overview
Typed HTML attributes for an SST node. Absent fields are nil.
Instance Attribute Summary collapse
-
#class_names ⇒ Object
readonly
Returns the value of attribute class_names.
-
#datetime ⇒ Object
readonly
Returns the value of attribute datetime.
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#itemprop ⇒ Object
readonly
Returns the value of attribute itemprop.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#src ⇒ Object
readonly
Returns the value of attribute src.
-
#srcset ⇒ Object
readonly
Returns the value of attribute srcset.
-
#style ⇒ Object
readonly
Returns the value of attribute style.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
-
.build(href: nil, src: nil, id: nil, class_names: nil, datetime: nil, itemprop: nil, style: nil, srcset: nil, type: nil, raw: nil) ⇒ Attrs
rubocop:disable Metrics/MethodLength, Metrics/ParameterLists.
- .empty ⇒ Attrs
Instance Method Summary collapse
Instance Attribute Details
#class_names ⇒ Object (readonly)
Returns the value of attribute class_names
16 17 18 |
# File 'lib/html2rss/sst/attrs.rb', line 16 def class_names @class_names end |
#datetime ⇒ Object (readonly)
Returns the value of attribute datetime
16 17 18 |
# File 'lib/html2rss/sst/attrs.rb', line 16 def datetime @datetime end |
#href ⇒ Object (readonly)
Returns the value of attribute href
16 17 18 |
# File 'lib/html2rss/sst/attrs.rb', line 16 def href @href end |
#id ⇒ Object (readonly)
Returns the value of attribute id
16 17 18 |
# File 'lib/html2rss/sst/attrs.rb', line 16 def id @id end |
#itemprop ⇒ Object (readonly)
Returns the value of attribute itemprop
16 17 18 |
# File 'lib/html2rss/sst/attrs.rb', line 16 def itemprop @itemprop end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw
16 17 18 |
# File 'lib/html2rss/sst/attrs.rb', line 16 def raw @raw end |
#src ⇒ Object (readonly)
Returns the value of attribute src
16 17 18 |
# File 'lib/html2rss/sst/attrs.rb', line 16 def src @src end |
#srcset ⇒ Object (readonly)
Returns the value of attribute srcset
16 17 18 |
# File 'lib/html2rss/sst/attrs.rb', line 16 def srcset @srcset end |
#style ⇒ Object (readonly)
Returns the value of attribute style
16 17 18 |
# File 'lib/html2rss/sst/attrs.rb', line 16 def style @style end |
#type ⇒ Object (readonly)
Returns the value of attribute type
16 17 18 |
# File 'lib/html2rss/sst/attrs.rb', line 16 def type @type end |
Class Method Details
.build(href: nil, src: nil, id: nil, class_names: nil, datetime: nil, itemprop: nil, style: nil, srcset: nil, type: nil, raw: nil) ⇒ Attrs
rubocop:disable Metrics/MethodLength, Metrics/ParameterLists
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/html2rss/sst/attrs.rb', line 33 def build(href: nil, src: nil, id: nil, class_names: nil, datetime: nil, itemprop: nil, style: nil, srcset: nil, type: nil, raw: nil) new( href: blank_to_nil(href), src: blank_to_nil(src), id: blank_to_nil(id), class_names: normalize_class_names(class_names), datetime: blank_to_nil(datetime), itemprop: blank_to_nil(itemprop), style: blank_to_nil(style), srcset: blank_to_nil(srcset), type: blank_to_nil(type), raw: normalize_raw(raw) ) end |
Instance Method Details
#class_attr ⇒ String
82 |
# File 'lib/html2rss/sst/attrs.rb', line 82 def class_attr = class_names.join(' ') |