class NRB::BeerXML::Builder
Constants
- RECORDS
Public Class Methods
record_sets()
click to toggle source
# File lib/nrb/beerxml/builder.rb, line 9 def self.record_sets; records.map() { |type| "#{type}s" }; end
records()
click to toggle source
# File lib/nrb/beerxml/builder.rb, line 8 def self.records; RECORDS; end
Public Instance Methods
build(type)
click to toggle source
# File lib/nrb/beerxml/builder.rb, line 12 def build(type) if record_set? type RecordSet.new record_type: underscore(type.sub(/s$/,'')).to_sym else ::Module.nesting[1].const_get(type).new end rescue NameError nil end
Private Instance Methods
record_set?(type)
click to toggle source
# File lib/nrb/beerxml/builder.rb, line 24 def record_set?(type) self.class.record_sets.include? type end