Class: ODDB::Business::GrantDownload

Inherits:
Model
  • Object
show all
Defined in:
lib/oddb/business/grant_download.rb,
lib/oddb/persistence/odba/business/grant_download.rb

Constant Summary

Constants included from OddbUri

OddbUri::YAML_URI

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#__odba_delete__, #__odba_save__, _serializables, belongs_to, connections, connector, connectors, #data_origin, #data_origins, delegates, #delete, find_by_uid, has_many, is_coded, m10l_document, multilingual, #odba_serializables, #oid, on_delete, on_save, predicates, #save, #saved?, serializables, serialize, singular

Methods included from ODBA::Persistable

#to_yaml_properties

Methods included from Yaml

append_features, #to_yaml_properties

Methods included from OddbUri

#to_yaml, #to_yaml_map, #to_yaml_type

Constructor Details

#initialize(email) ⇒ GrantDownload

Returns a new instance of GrantDownload.



11
12
13
14
# File 'lib/oddb/business/grant_download.rb', line 11

def initialize(email)
  self.email.de = email
  @grant_list = {}
end

Instance Attribute Details

#grant_listObject (readonly)

Returns the value of attribute grant_list.



10
11
12
# File 'lib/oddb/business/grant_download.rb', line 10

def grant_list
  @grant_list
end

Instance Method Details

#expired?(file) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
# File 'lib/oddb/business/grant_download.rb', line 18

def expired?(file)
  if expiry_time = @grant_list[file]
    expiry_time < Time.now
  else
    true
  end
end

#grant_download(file, expiry_time) ⇒ Object



15
16
17
# File 'lib/oddb/business/grant_download.rb', line 15

def grant_download(file, expiry_time)
  @grant_list[file] = expiry_time
end