Class: OpenGraphy::MetaTag

Inherits:
Object
  • Object
show all
Defined in:
lib/open_graphy/meta_tag.rb

Instance Method Summary collapse

Constructor Details

#initialize(doc, meta_tag) ⇒ MetaTag

Returns a new instance of MetaTag.



3
4
5
# File 'lib/open_graphy/meta_tag.rb', line 3

def initialize(doc, meta_tag)
  @doc, @meta_tag = doc, meta_tag
end

Instance Method Details

#nameObject



15
16
17
# File 'lib/open_graphy/meta_tag.rb', line 15

def name
  @meta_tag.attr('property').sub(tag_name, '')
end

#namespaceObject



7
8
9
# File 'lib/open_graphy/meta_tag.rb', line 7

def namespace
  @namespace ||= TagNamespace.new(tag_name.split(':'))
end

#valid?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/open_graphy/meta_tag.rb', line 11

def valid?
  tag_name
end

#valueObject



19
20
21
# File 'lib/open_graphy/meta_tag.rb', line 19

def value
  @meta_tag.attr('content').to_s
end