Class: ShafClient::Alps::Descriptor
- Inherits:
-
Object
- Object
- ShafClient::Alps::Descriptor
- Defined in:
- lib/shaf_client/alps/descriptor.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
-
#ext ⇒ Object
(also: #extensions)
readonly
Returns the value of attribute ext.
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #extension(id) ⇒ Object
- #idempotent? ⇒ Boolean
-
#initialize(id:, **kwargs) ⇒ Descriptor
constructor
A new instance of Descriptor.
- #safe? ⇒ Boolean
- #semantic? ⇒ Boolean
- #to_h ⇒ Object
- #unsafe? ⇒ Boolean
Constructor Details
#initialize(id:, **kwargs) ⇒ Descriptor
Returns a new instance of Descriptor.
8 9 10 11 12 13 14 15 |
# File 'lib/shaf_client/alps/descriptor.rb', line 8 def initialize(id:, **kwargs) @id = id.to_sym @href = kwargs[:href] @name = kwargs[:name] @type = kwargs[:type] @doc = kwargs[:doc] @ext = parse_extentions(kwargs[:ext]) end |
Instance Attribute Details
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
6 7 8 |
# File 'lib/shaf_client/alps/descriptor.rb', line 6 def doc @doc end |
#ext ⇒ Object (readonly) Also known as: extensions
Returns the value of attribute ext.
6 7 8 |
# File 'lib/shaf_client/alps/descriptor.rb', line 6 def ext @ext end |
#href ⇒ Object (readonly)
Returns the value of attribute href.
6 7 8 |
# File 'lib/shaf_client/alps/descriptor.rb', line 6 def href @href end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/shaf_client/alps/descriptor.rb', line 6 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/shaf_client/alps/descriptor.rb', line 6 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/shaf_client/alps/descriptor.rb', line 6 def type @type end |
Instance Method Details
#extension(id) ⇒ Object
46 47 48 |
# File 'lib/shaf_client/alps/descriptor.rb', line 46 def extension(id) extensions.find { |ext| ext.id == id.to_sym } end |
#idempotent? ⇒ Boolean
38 39 40 |
# File 'lib/shaf_client/alps/descriptor.rb', line 38 def idempotent? type == 'idempotent' end |
#safe? ⇒ Boolean
34 35 36 |
# File 'lib/shaf_client/alps/descriptor.rb', line 34 def safe? type == 'safe' end |
#semantic? ⇒ Boolean
30 31 32 |
# File 'lib/shaf_client/alps/descriptor.rb', line 30 def semantic? type == 'semantic' end |
#to_h ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/shaf_client/alps/descriptor.rb', line 19 def to_h { id: id, href: href, name: name, type: type, doc: doc, ext: extensions.map(&:to_h), } end |
#unsafe? ⇒ Boolean
42 43 44 |
# File 'lib/shaf_client/alps/descriptor.rb', line 42 def unsafe? type == 'unsafe' end |