Method: CItem#initialize
- Defined in:
- lib/coursegen/course/data/citem.rb
#initialize(nitem = nil, ident = nil, type = nil, order = nil) ⇒ CItem
Callable with nitem=nil to create a mock
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/coursegen/course/data/citem.rb', line 15 def initialize(nitem=nil, ident=nil, type=nil, order=nil) if !nitem.nil? # path to create a real citem fail ArgumentError, "invalid CItem contruction" unless ident.nil? @nitem = nitem defaults_from_nitem parse_identifier @nitem.identifier else # path to create a mock citem fail ArgumentError, "invalid CItem contruction" unless nitem.nil? @nitem = nil @status = nil @type = type @identifier = ident @order = order @title = ident @style = nil parse_identifier(ident) end end |