Module: Bipm::Data::Outcomes
- Includes:
- Enumerable
- Defined in:
- lib/bipm/data/outcomes.rb,
lib/bipm/data/outcomes/body.rb,
lib/bipm/data/outcomes/action.rb,
lib/bipm/data/outcomes/meeting.rb,
lib/bipm/data/outcomes/approval.rb,
lib/bipm/data/outcomes/resolution.rb,
lib/bipm/data/outcomes/consideration.rb,
lib/bipm/data/outcomes/localized_body.rb
Defined Under Namespace
Classes: Action, Approval, Body, Consideration, LocalizedBody, Meeting, Resolution
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Attribute Details
#file_path=(value) ⇒ Object
Sets the attribute file_path
17
18
19
|
# File 'lib/bipm/data/outcomes.rb', line 17
def file_path=(value)
@file_path = value
end
|
Class Method Details
.bodies ⇒ Object
25
26
27
28
29
30
31
32
|
# File 'lib/bipm/data/outcomes.rb', line 25
def self.bodies
%i[
ccauv ccem ccl ccm ccpr ccqm ccri cct cctf ccu
cgpm cipm jcgm jcrb
].to_h do |name|
[name, body(name)]
end
end
|
.body(name) ⇒ Object
19
20
21
22
|
# File 'lib/bipm/data/outcomes.rb', line 19
def self.body(name)
ensure_downloaded
Body.new(name)
end
|
.each(&block) ⇒ Object
34
35
36
|
# File 'lib/bipm/data/outcomes.rb', line 34
def self.each(&block)
bodies.values.each(&block)
end
|
.ensure_downloaded ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/bipm/data/outcomes.rb', line 39
def self.ensure_downloaded
if File.exist?(file_path)
return
elsif !File.writable?(File.dirname(file_path))
require "fileutils"
self.file_path = "#{ENV["HOME"]}/.local/share/metanorma/bipm-data-importer/data/"
FileUtils.mkdir_p(File.dirname(self.file_path))
end
git_path = "https://github.com/metanorma/bipm-data-outcomes"
system "git", "clone", git_path, file_path or
raise "Downloading bipm-data-outcomes failed: possibly git not available"
end
|
.file_path ⇒ Object
14
15
16
|
# File 'lib/bipm/data/outcomes.rb', line 14
def self.file_path
@file_path ||= "#{__dir__}/../../../data/"
end
|