Class: Imageomatic::Opengraph::Base::Property

Inherits:
Object
  • Object
show all
Defined in:
app/models/imageomatic/opengraph/base.rb

Overview

Encapsulates OpenGraph properties and provides helpers that are useful for documentation purposes or for reflecting on Ruby objects.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, description = nil, default: nil) ⇒ Property

Returns a new instance of Property.



11
12
13
14
15
16
17
# File 'app/models/imageomatic/opengraph/base.rb', line 11

def initialize(key, description = nil, default: nil)
  @key = key
  @description = description
  # If we get a string like `og:image:url`, this would give us `url`
  *_, @name = key.rpartition(":")
  @default = default
end

Instance Attribute Details

#defaultObject

Returns the value of attribute default.



9
10
11
# File 'app/models/imageomatic/opengraph/base.rb', line 9

def default
  @default
end

#descriptionObject

Returns the value of attribute description.



9
10
11
# File 'app/models/imageomatic/opengraph/base.rb', line 9

def description
  @description
end

#keyObject

Returns the value of attribute key.



9
10
11
# File 'app/models/imageomatic/opengraph/base.rb', line 9

def key
  @key
end

#nameObject

Returns the value of attribute name.



9
10
11
# File 'app/models/imageomatic/opengraph/base.rb', line 9

def name
  @name
end