Class: Aspire::Object::Module

Inherits:
Base
  • Object
show all
Includes:
Properties
Defined in:
lib/aspire/object/module.rb

Overview

Represents a module in the Aspire API

Constant Summary

Constants included from Properties

Properties::AIISO_CODE, Properties::AIISO_NAME, Properties::CREATED, Properties::DESCRIPTION, Properties::HAS_CREATOR, Properties::HAS_OWNER, Properties::LAST_PUBLISHED, Properties::LAST_UPDATED, Properties::NAME, Properties::PUBLISHED_BY, Properties::USED_BY

Constants inherited from Base

Base::STRIP_HTML

Constants included from Util

Util::LD_API_URI

Instance Attribute Summary collapse

Attributes inherited from Base

#factory, #uri

Instance Method Summary collapse

Methods inherited from Base

#get_boolean, #get_date, #get_property

Methods included from Util

#child_url?, #duration, #id_from_uri, #item?, #linked_data, #linked_data_path, #list?, #list_url?, #module?, #parent_url?, #parse_url, #resource?, #section?, #url_for_comparison, #url_path, #user?

Constructor Details

#initialize(uri, factory, json: nil, ld: nil) ⇒ Module

Initialises a new Module instance



19
20
21
22
23
24
25
26
27
# File 'lib/aspire/object/module.rb', line 19

def initialize(uri, factory, json: nil, ld: nil)
  super(uri, factory)
  self.code =
    get_property('code', json) ||
    get_property(AIISO_CODE, ld)
  self.name =
    get_property('name', json) ||
    get_property(AIISO_NAME, ld)
end

Instance Attribute Details

#codeString

Returns the module code.

Returns:

  • (String)

    the module code



12
13
14
# File 'lib/aspire/object/module.rb', line 12

def code
  @code
end

#nameString

Returns the module name.

Returns:

  • (String)

    the module name



16
17
18
# File 'lib/aspire/object/module.rb', line 16

def name
  @name
end

Instance Method Details

#to_sString

Returns a string representation of the Module instance (the module name)

Returns:

  • (String)

    the string representation of the Module instance



31
32
33
# File 'lib/aspire/object/module.rb', line 31

def to_s
  name.to_s || super
end