Class: ONIX::CodeFromYaml

Inherits:
Code show all
Defined in:
lib/onix/code.rb

Direct Known Subclasses

AVItemIDType, AVItemType, AgentIDType, AgentRole, AncillaryContentType, AudienceCode, AudienceCodeType, AudienceRangePrecision, AudienceRangeQualifier, BarcodeType, BibleContents, BiblePurpose, BibleReferenceLocation, BibleTextFeature, BibleTextOrganization, BibleVersion, CitedContentType, CodeFromYamlWithMime, CollectionIDType, CollectionSequenceType, CollectionType, ComplexitySchemeIdentifier, ConferenceRole, ContentAudience, ContentDateRole, ContributorDateRole, ContributorPlaceRelator, ContributorRole, CopyrightType, CountryCode, CurrencyZone, DateFormat, DiscountCodeType, DiscountType, EditionType, EpubLicenseExpressionType, EpubTechnicalProtection, EpubUsageStatus, EpubUsageType, EpubUsageUnit, EventIDType, EventStatus, EventType, ExtentType, ExtentUnit, FundingIDType, Gender, IDType, Illustrated, LanguageCode, LanguageRole, MarketDateRole, MarketPublishingStatus, MeasureType, MeasureUnitCode, NameType, NotificationType, OccurrenceDateRole, PositionOnProduct, PriceCodeType, PriceConditionQuantityType, PriceConditionType, PriceConstraintType, PriceDateRole, PriceIDType, PricePer, PriceQualifier, PriceStatus, PriceType, PrintedOnProduct, PrizeCode, ProductAvailability, ProductClassificationType, ProductComposition, ProductContactRole, ProductContentType, ProductForm, ProductFormFeatureType, ProductIDType, ProductPackaging, ProductRelationCode, Proximity, PublishingDateRole, PublishingRole, PublishingStatus, QuantityUnit, RecordSourceType, RegionCode, ReligiousTextFeatureCode, ReligiousTextFeatureType, ReligiousTextIdentifier, ResourceContentType, ResourceFeatureType, ResourceForm, ResourceMode, ResourceVersionFeatureType, ReturnsCode, ReturnsCodeType, SalesOutletIDType, SalesRestrictionType, SalesRightsType, ScriptCode, SourceType, StockQuantityCodeType, StudyBibleType, SubjectSchemeIdentifier, SupplierCodeType, SupplierIDType, SupplierRole, SupplyContactRole, SupplyDateRole, TaxRateCode, TaxType, TextCase, TextFormat, TextItemIDType, TextItemType, TextType, ThesisType, TitleElementLevel, TitleType, TradeCategory, UnnamedPersons, UnpricedItemType, VelocityMetric, WebsiteRole, WorkIDType, WorkRelationCode

Instance Attribute Summary

Attributes inherited from Code

#code, #human

Attributes included from Attributes

#attributes

Class Method Summary collapse

Methods inherited from Code

from_code, from_human

Methods included from CodeMethods

#human, #onix, #parse

Methods inherited from Subset

parse, #parse, #tag_match, #unsupported

Methods included from Attributes

attribute_class, #parse_attributes, #serialized_attributes

Class Method Details

.code_identObject



77
78
79
# File 'lib/onix/code.rb', line 77

def code_ident
  nil
end

.code_identifier(code) ⇒ Object



81
82
83
84
85
# File 'lib/onix/code.rb', line 81

def code_identifier code
  define_singleton_method :code_ident do
    return code
  end
end

.hashObject



69
70
71
# File 'lib/onix/code.rb', line 69

def hash
  @hash ||= YAML.load(File.open(File.dirname(__FILE__) + "/../../data/codelists/codelist-#{self.code_ident}.yml"))[:codelist].freeze
end

.listObject



73
74
75
# File 'lib/onix/code.rb', line 73

def list
  self.hash.keys
end