Class: Datasets::License

Inherits:
Struct
  • Object
show all
Defined in:
lib/datasets/license.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



2
3
4
# File 'lib/datasets/license.rb', line 2

def name
  @name
end

#spdx_idObject

Returns the value of attribute spdx_id

Returns:

  • (Object)

    the current value of spdx_id



2
3
4
# File 'lib/datasets/license.rb', line 2

def spdx_id
  @spdx_id
end

#urlObject

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



2
3
4
# File 'lib/datasets/license.rb', line 2

def url
  @url
end

Class Method Details

.try_convert(value) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/datasets/license.rb', line 6

def try_convert(value)
  case value
  when self
    value
  when String
    license = new
    license.spdx_id = value
    license
  when Hash
    license = new
    license.spdx_id = value[:spdx_id]
    license.name = value[:name]
    license.url = value[:url]
    license
  else
    nil
  end
end