Class: Nemweb::DataFile

Inherits:
Struct
  • Object
show all
Defined in:
lib/nemweb/data_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri, client) ⇒ DataFile

Returns a new instance of DataFile.



5
6
7
8
# File 'lib/nemweb/data_file.rb', line 5

def initialize(uri, client)
  super(uri)
  @client = client
end

Instance Attribute Details

#uriObject

Returns the value of attribute uri

Returns:

  • (Object)

    the current value of uri



3
4
5
# File 'lib/nemweb/data_file.rb', line 3

def uri
  @uri
end

Instance Method Details

#nameObject



10
11
12
# File 'lib/nemweb/data_file.rb', line 10

def name
  File.basename(uri.path)
end

#parse(&block) ⇒ Object



18
19
20
# File 'lib/nemweb/data_file.rb', line 18

def parse(&block)
  @client.parse(uri, &block)
end

#periodObject



14
15
16
# File 'lib/nemweb/data_file.rb', line 14

def period
  name.scan(/_(\d{4,})/).first.first
end