Class: Udb::License

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/udb/obj/database_obj.rb

Overview

License information

Instance Method Summary collapse

Constructor Details

#initialize(data)

Parameters:

  • data (Hash{String => String, nil})


482
483
484
# File 'lib/udb/obj/database_obj.rb', line 482

def initialize(data)
  @data = data
end

Instance Method Details

#nameString

Returns License name.

Returns:

  • (String)

    License name



488
# File 'lib/udb/obj/database_obj.rb', line 488

def name = T.must(@data["name"])

#textString

Returns Text of the license.

Returns:

  • (String)

    Text of the license



497
498
499
500
501
502
503
# File 'lib/udb/obj/database_obj.rb', line 497

def text
  if !@data["text_url"].nil?
    T.must(Net::HTTP.get(URI(T.must(@data["text_url"]))))
  else
    T.cast(@data.fetch("text"), String)
  end
end

#urlnil, String

Returns:

  • (nil)

    if there is no website for the license

  • (String)

    License website



493
# File 'lib/udb/obj/database_obj.rb', line 493

def url = T.must(@data["url"])