Sha256: 262237c96f2d6fa30604bd5b000f9345a1b030c8c57cd4554f1c707567a404a7
Contents?: true
Size: 606 Bytes
Versions: 5
Compression:
Stored size: 606 Bytes
Contents
module ModelXML class BlockParser class << self def parse &block raise "block required" unless block_given? parser = self.new parser.instance_eval &block parser.field_set end end attr_reader :field_set def initialize @field_set = [] end def method_missing *args # if the method is called without arguments, add it as a member of the field set if args.map(&:class) == [Symbol] @field_set << args[0] # otherwise add it as an array else @field_set << args end end end end
Version data entries
5 entries across 5 versions & 1 rubygems