Sha256: e995b6bcb31ce45cbba997acbfe91668e0eecaf4012cacb3f9ead0a15e5688e5
Contents?: true
Size: 902 Bytes
Versions: 9
Compression:
Stored size: 902 Bytes
Contents
class QuestionGroup # Context, Content, Display attr_accessor :id, :section_id, :section, :parser attr_accessor :text, :help_text attr_accessor :display_type # id, section and text required def initialize(section, args, options) self.parser = section.parser self.id = parser.new_question_group_id self.text = args[0] self.default_options().merge(options).merge(args[1] || {}).each{|key,value| self.instance_variable_set("@#{key}", value)} end def default_options() {:display_type => "default"} end def to_yml out =[ %(#{@id}:) ] out << %( id: #{@id}) out << %( text: "#{@text}") out << %( help_text: "#{@help_text}") out << %( display_type: "#{@display_type}") (out << nil ).join("\r\n") end def to_file File.open(self.parser.question_groups_yml, File::CREAT|File::APPEND|File::WRONLY){ |f| f << to_yml } end end
Version data entries
9 entries across 9 versions & 2 rubygems