Class: MCP::Icon
- Inherits:
-
Object
- Object
- MCP::Icon
- Defined in:
- lib/mcp/icon.rb
Constant Summary collapse
- SUPPORTED_THEMES =
["light", "dark"]
Instance Attribute Summary collapse
-
#mime_type ⇒ Object
readonly
Returns the value of attribute mime_type.
-
#sizes ⇒ Object
readonly
Returns the value of attribute sizes.
-
#src ⇒ Object
readonly
Returns the value of attribute src.
-
#theme ⇒ Object
readonly
Returns the value of attribute theme.
Instance Method Summary collapse
-
#initialize(mime_type: nil, sizes: nil, src: nil, theme: nil) ⇒ Icon
constructor
A new instance of Icon.
- #to_h ⇒ Object
Constructor Details
#initialize(mime_type: nil, sizes: nil, src: nil, theme: nil) ⇒ Icon
Returns a new instance of Icon.
9 10 11 12 13 14 15 16 |
# File 'lib/mcp/icon.rb', line 9 def initialize(mime_type: nil, sizes: nil, src: nil, theme: nil) raise ArgumentError, 'The value of theme must specify "light" or "dark".' if theme && !SUPPORTED_THEMES.include?(theme) @mime_type = mime_type @sizes = sizes @src = src @theme = theme end |
Instance Attribute Details
#mime_type ⇒ Object (readonly)
Returns the value of attribute mime_type.
7 8 9 |
# File 'lib/mcp/icon.rb', line 7 def mime_type @mime_type end |
#sizes ⇒ Object (readonly)
Returns the value of attribute sizes.
7 8 9 |
# File 'lib/mcp/icon.rb', line 7 def sizes @sizes end |
#src ⇒ Object (readonly)
Returns the value of attribute src.
7 8 9 |
# File 'lib/mcp/icon.rb', line 7 def src @src end |
#theme ⇒ Object (readonly)
Returns the value of attribute theme.
7 8 9 |
# File 'lib/mcp/icon.rb', line 7 def theme @theme end |
Instance Method Details
#to_h ⇒ Object
18 19 20 |
# File 'lib/mcp/icon.rb', line 18 def to_h { mimeType: mime_type, sizes: sizes, src: src, theme: theme }.compact end |