Module: Ietf::Data::Importer
- Defined in:
- lib/ietf/data/importer.rb,
lib/ietf/data/importer/cli.rb,
lib/ietf/data/importer/group.rb,
lib/ietf/data/importer/version.rb,
lib/ietf/data/importer/scrapers.rb,
lib/ietf/data/importer/group_collection.rb,
lib/ietf/data/importer/scrapers/base_scraper.rb,
lib/ietf/data/importer/scrapers/ietf_scraper.rb,
lib/ietf/data/importer/scrapers/irtf_scraper.rb
Overview
Main module for IETF/IRTF group data importer
Defined Under Namespace
Modules: Scrapers Classes: Cli, Error, Group, GroupCollection
Constant Summary collapse
- GROUPS_PATH =
Path to the groups data file
File.join(File.dirname(__FILE__), "importer", "groups.yaml")
- VERSION =
"0.3.0"
Class Method Summary collapse
-
.active_groups ⇒ Object
Get active groups.
-
.areas ⇒ Object
Get all available areas.
-
.concluded_groups ⇒ Object
Get concluded groups.
-
.find_group(abbreviation) ⇒ Object
Find a group by its abbreviation (case insensitive).
-
.group_exists?(abbreviation) ⇒ Boolean
Check if a group exists by abbreviation.
-
.group_types ⇒ Object
Get all available group types.
-
.groups ⇒ Object
All available groups.
-
.groups_by_area(area) ⇒ Object
Get groups by area.
-
.groups_by_type(type) ⇒ Object
Get groups by type.
-
.ietf_groups ⇒ Object
Get all IETF groups.
-
.irtf_groups ⇒ Object
Get all IRTF groups.
-
.load_groups ⇒ Object
Load the groups if the file exists, otherwise return empty collection.
-
.research_groups ⇒ Object
Get all research groups (IRTF).
-
.working_groups ⇒ Object
Get all working groups (IETF).
Class Method Details
.active_groups ⇒ Object
Get active groups
73 74 75 |
# File 'lib/ietf/data/importer.rb', line 73 def self.active_groups groups.select { |g| g.status == "active" } end |
.areas ⇒ Object
Get all available areas
88 89 90 |
# File 'lib/ietf/data/importer.rb', line 88 def self.areas groups.map(&:area).compact.uniq.sort end |
.concluded_groups ⇒ Object
Get concluded groups
78 79 80 |
# File 'lib/ietf/data/importer.rb', line 78 def self.concluded_groups groups.select { |g| g.status == "concluded" } end |
.find_group(abbreviation) ⇒ Object
Find a group by its abbreviation (case insensitive)
38 39 40 |
# File 'lib/ietf/data/importer.rb', line 38 def self.find_group(abbreviation) groups.find { |g| g.abbreviation.downcase == abbreviation.to_s.downcase } end |
.group_exists?(abbreviation) ⇒ Boolean
Check if a group exists by abbreviation
33 34 35 |
# File 'lib/ietf/data/importer.rb', line 33 def self.group_exists?(abbreviation) !find_group(abbreviation).nil? end |
.group_types ⇒ Object
Get all available group types
83 84 85 |
# File 'lib/ietf/data/importer.rb', line 83 def self.group_types groups.map(&:type).uniq.sort end |
.groups ⇒ Object
All available groups
28 29 30 |
# File 'lib/ietf/data/importer.rb', line 28 def self.groups load_groups.groups end |
.groups_by_area(area) ⇒ Object
Get groups by area
68 69 70 |
# File 'lib/ietf/data/importer.rb', line 68 def self.groups_by_area(area) groups.select { |g| g.area&.downcase == area.to_s.downcase } end |
.groups_by_type(type) ⇒ Object
Get groups by type
63 64 65 |
# File 'lib/ietf/data/importer.rb', line 63 def self.groups_by_type(type) groups.select { |g| g.type.downcase == type.to_s.downcase } end |
.ietf_groups ⇒ Object
Get all IETF groups
43 44 45 |
# File 'lib/ietf/data/importer.rb', line 43 def self.ietf_groups groups.select { |g| g.organization == "ietf" } end |
.irtf_groups ⇒ Object
Get all IRTF groups
48 49 50 |
# File 'lib/ietf/data/importer.rb', line 48 def self.irtf_groups groups.select { |g| g.organization == "irtf" } end |
.load_groups ⇒ Object
Load the groups if the file exists, otherwise return empty collection
19 20 21 22 23 24 25 |
# File 'lib/ietf/data/importer.rb', line 19 def self.load_groups if File.exist?(GROUPS_PATH) GroupCollection.from_yaml(File.read(GROUPS_PATH)) else GroupCollection.new(groups: []) end end |
.research_groups ⇒ Object
Get all research groups (IRTF)
58 59 60 |
# File 'lib/ietf/data/importer.rb', line 58 def self.research_groups groups.select { |g| g.type == "rg" } end |
.working_groups ⇒ Object
Get all working groups (IETF)
53 54 55 |
# File 'lib/ietf/data/importer.rb', line 53 def self.working_groups groups.select { |g| g.type == "wg" } end |