gb-agencies
Gem to look up agency names for GB standards
# hash of localised labels
LABELS = { "PRC" => "PRC", # People's Republic of China
"industry_standard" => "Industry Standard",
"local_standard" => "Local Standard",
"enterprise_standard" => "Enterprise Standard",
"social_standard" => "Social Standard" }
# language (only "en", "zh" defined)
# LABELS: hash of localised labels
# issuer: name of organisation issuing the standard (only used for enterprise and social-group standards;
# this gem provides lookup for local, sector, and national agency names)
gba = GbAgencies::Agencies.new("en", LABELS, "My Org")
# scope: "national", "sector", "local", "enterprise", "social-group"
# prefix: the prefix of the standard
# mandate: "mandatory", "recommended", "guide"
gba.standard_class("national", "GB", "mandatory")
=> "National standard"
gba.standard_class("local", "81", "guide")
=> "Hong Kong Special Administrative Region Local Standard"
# scope: "national", "sector", "local", "enterprise", "social-group"
# prefix: the prefix of the standard
# mandate: "mandatory", "recommended", "guide"
gba.standard_agency("national", "GB", "mandatory")
=> "General Administration of Quality Supervision, Inspection and Quarantine; Standardization Administration of China"
# return agency as single string
GbAgencies::Agencies.new("zh", LABELS, "My Org").standard_agency1("national", "GB", "mandatory")
# return agency as array (where there is more than one body involved)
GbAgencies::Agencies.new("zh", LABELS, "My Org").standard_agency("national", "GB", "mandatory")
=> "["中华人民共和国国家质量监督检验检疫总局 中国国家标准化管理委员会"]
# scope: "national", "sector", "local", "enterprise", "social-group"
# prefix: the prefix of the standard
# mandate: "mandatory", "recommended", "guide"
# year: year of publication
# nunumber: the number of the standard
gba.docidentifier("social-group", "PREFIX", "guide", "2002", "123")
=> "T/Z/PREFIX 123—2002"
# scope: "national", "sector", "local", "enterprise", "social-group"
# prefix: the prefix of the standard
gba.gbtype_validate("national", "GB")
=> true
# scope: "national", "sector", "local", "enterprise", "social-group"
# prefix: the prefix of the standard
gba.gbtype_validate("national", "ZZ")
ZZ is not a recognised national prefix
=> false