class Story < Empirical::Client::Endpoints::Activity

  # attributes :body, :instructions

  attr_accessor :chunks, :parsed

  def assessment
    self
  end

  def chunks
    @chunks ||= GrammarChunker.chunk(parsed)
  end
  delegate :questions, to: :chunks

  def body_parser
    body = YAML.load(activity.data.body).gsub("\n", "<br>").html_safe

  end


  def parsed
    @parsed ||= GrammarParser.new.parse(body_parser)[:questions]
  end

  def question_quantity_for_rule rule
    3
  end

  def as_json
    {
      body: YAML.load(activity.data.body),
      id: id
    }
  end

  def to_json
    as_json.to_json
  end

end


class Story < Empirical::Client::Endpoints::Activity

  # attributes :body, :instructions

  attr_accessor :chunks, :parsed

  def assessment
    self
  end

  def chunks
    @chunks ||= GrammarChunker.chunk(parsed)
  end
  delegate :questions, to: :chunks

  def body_parser
    body = YAML.load(activity.data.body).gsub("\n", "<br>").html_safe

  end

  def model_name
    ActiveModel::Name.new(Story)
  end


  def parsed
    @parsed ||= GrammarParser.new.parse(body_parser)[:questions]
  end

  def question_quantity_for_rule rule
    3
  end

  def as_json
    {
      body: YAML.load(activity.data.body),
      id: id
    }
  end

  def to_json
    as_json.to_json
  end

end


Fix a bug for form_for
Fix a bug for form_for
