遅々とした進行

先日作ったParser::Baseを継承してデフォルト・パーサーのクラスを作ったのはいいものの,問題はプラグインのロード順。Baseの方を先に読み込んでもらわないといけないのに,どうしてもうまくrequireできない。いろいろ調べるうちに,ようやくRailsのフォーラムでenvironment.rbの中に
config.plugins = [ "prefixed", "parser_base", "default_parser" ]
などと書くことで動くことが判明。ここまでかなり不毛な時間を過ごしました。パーサーにもいくつかバグがあったので,それを取りつつ,いちおう動くようになってきました。
例えばDefaultParserのクラスは

class DefaultParser <Parser::Base
  def exec str
    str.rstrip!
    str.lstrip!
    str =~ /^(\w+)(?:\((.*)\))?$/m
    command = $1
    paramall = $2
    params = paramall.split(/[\t\r\n\f\v]*,[\t\r\n\f\v]*/)
    params.unshift paramall
    begin
      self.send(command, params)
    rescue
       command+'('+paramall+')'
    end
  end

  def parsedinclude fname
    contents = $skin.file(fname[1])
    self.parse contents
  end
end

としているのですが,ここでなぜかparsedincludeの中でパースしてくれません。self.parseの行を取るとincludeはできているのですが。ちょっと不思議。


05 Nov, 2007 | General | | Andy
« Prev item - Next Item »
---------------------------------------------

Comments


No comments yet. You can be the first!


Leave comment

© 2007 yoursite.com | Designed by DesignsByDarren
Ported to Nucleus CMS: Suvoroff