Class: Imageomatic::Opengraph::Base::Property
- Inherits:
-
Object
- Object
- Imageomatic::Opengraph::Base::Property
- 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
-
#default ⇒ Object
Returns the value of attribute default.
-
#description ⇒ Object
Returns the value of attribute description.
-
#key ⇒ Object
Returns the value of attribute key.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(key, description = nil, default: nil) ⇒ Property
constructor
A new instance of Property.
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
#default ⇒ Object
Returns the value of attribute default.
9 10 11 |
# File 'app/models/imageomatic/opengraph/base.rb', line 9 def default @default end |
#description ⇒ Object
Returns the value of attribute description.
9 10 11 |
# File 'app/models/imageomatic/opengraph/base.rb', line 9 def description @description end |
#key ⇒ Object
Returns the value of attribute key.
9 10 11 |
# File 'app/models/imageomatic/opengraph/base.rb', line 9 def key @key end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'app/models/imageomatic/opengraph/base.rb', line 9 def name @name end |