Skip to content

解析 oppia 的 yaml

Kaid Wong edited this page Mar 7, 2014 · 6 revisions

目的

把 oppia 的 yaml 数据解析到结构合理的 ruby class 中

  1. 模型以及模型关系
Exploration
  has_many State

State
  has_one  Content
  has_one  Widget

Widget
  has_many Handler

Handler
  has_many RuleSpec

RuleSpec
  has_one State as :dest

2 各个模型上的方法

Exploration
  ::from_yaml(yaml_path) => 载入并解析yaml文件
  #init_state_name       => 起始State的名称
  #states                => 该Exploration下的所有State

State
  #content => 该State关联的的Content
  #widget  => 该State关联的Widget交互控件

Widget
  #handlers => 该Widget下的所有Handler答案提交处理器

Handler
  #rule_specs => 该Handler下的所有的RuleSpec规则

RuleSpec
  #definition => 该RuleSpec的参数设置
  #dest       => 该RuleSpec导向的下一步State

3 详细编码

https://github.com/kaid/goal_solution/blob/master/lib/models/oppia.rb

https://github.com/kaid/goal_solution/tree/master/lib/models/oppia

Clone this wiki locally