class Bismas::Schema
Constants
- CATEGORY_RE
- FIELD_RE
Attributes
category_length[RW]
name[RW]
title[RW]
Public Class Methods
new()
click to toggle source
# File lib/bismas/schema.rb, line 55 def initialize @title, @name, @category_length, @categories = nil, nil, nil, {} end
parse(*args)
click to toggle source
# File lib/bismas/schema.rb, line 44 def parse(*args) new.parse(*args) end
parse_file(file, options = {})
click to toggle source
# File lib/bismas/schema.rb, line 48 def parse_file(file, options = {}) Bismas.amend_encoding(options) File.open(file, 'rb', options, &method(:parse)) end
Public Instance Methods
parse(io)
click to toggle source
# File lib/bismas/schema.rb, line 65 def parse(io) category_re = nil io.each { |line| case line when category_re self[$1.strip] = $2.strip when FIELD_RE category_re = CATEGORY_RE[ self.category_length = $1.to_i] when String title ? name ? nil : self.name = line.strip : self.title = line.strip end } self end