Class: WebInspector::Meta
- Inherits:
-
Object
- Object
- WebInspector::Meta
- Defined in:
- lib/web_inspector/meta.rb
Instance Method Summary collapse
- #author ⇒ Object
- #charset ⇒ Object
-
#initialize(page) ⇒ Meta
constructor
A new instance of Meta.
- #meta ⇒ Object
- #meta_tag ⇒ Object
- #meta_tags ⇒ Object
- #publisher ⇒ Object
Constructor Details
#initialize(page) ⇒ Meta
Returns a new instance of Meta.
5 6 7 |
# File 'lib/web_inspector/meta.rb', line 5 def initialize(page) @page = page end |
Instance Method Details
#author ⇒ Object
32 33 34 35 36 |
# File 'lib/web_inspector/meta.rb', line 32 def ['name']['author'] || ['property']['article:author'] rescue StandardError nil end |
#charset ⇒ Object
44 45 46 |
# File 'lib/web_inspector/meta.rb', line 44 def charset @charset ||= || || charset_from_header || 'utf-8' end |
#meta ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/web_inspector/meta.rb', line 23 def ['name'] .merge(['http-equiv']) .merge(['property']) .merge(['itemprop'] || {}) .merge('charset' => ['charset']) .merge('author' => , 'publisher' => publisher) end |
#meta_tag ⇒ Object
19 20 21 |
# File 'lib/web_inspector/meta.rb', line 19 def convert_each_array_to_first_element_on end |
#meta_tags ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/web_inspector/meta.rb', line 9 def { 'name' => ('name'), 'http-equiv' => ('http-equiv'), 'property' => ('property'), 'charset' => [], 'itemprop' => ('itemprop') # Add support for schema.org microdata } end |
#publisher ⇒ Object
38 39 40 41 42 |
# File 'lib/web_inspector/meta.rb', line 38 def publisher ['property']['article:publisher'] || ['property']['og:site_name'] rescue StandardError nil end |