fyi : rexml eruby cache'ing

Ask a Question related to Ruby, Design and Development.

  1. #1

    Default fyi : rexml eruby cache'ing

    >>Please avoid top-posting.<<

    Is this a top-posting? How do i submit a sub
    top-posting?

    Anyway i submitted a post about rexml perhaps
    intermittantly caching a file. I figured out why.

    before, i was loading the xml like this...

    $global =
    REXML::Document.new(File.new('xml/global.xml'))

    and not closing file.

    now, instead, i do this
    $globalFile = File.new('xml/global.xml')
    $global = REXML::Document.new($globalFile)
    ....
    $globalFile.close

    and close $globalFile at the end.

    Anyway, alls groovy now.

    THanks,:P




    __________________________________
    Do you Yahoo!?
    Yahoo! SiteBuilder - Free, easy-to-use web site design software
    [url]http://sitebuilder.yahoo.com[/url]

    paul vudmaska Guest

  2. Similar Questions and Discussions

    1. eRuby and URL rewriting
      I am in the process of doing some web page authoring using eRuby. My question is this-- how do I access the post/get information in URL...
    2. CGI Authentication in eruby
      Hello, What is the way to implement the functionality of php $PHP_AUTH_USER and $PHP_AUTH_PW in Ruby? I've looked on CGI and CGI:Session. but...
    3. my mod_ruby doesn't like my eruby
      Hi, I'm not able to make eruby work with mod_ruby for some reason and I haven't found any solutions by looking at cases with a similar problem....
    4. soap4r 1.4.8.1 with REXML 2.7.1 - no REXML::VERSION_MAJOR
      I grabbed the latest soap4r and had a go with the wsdl driver, only to come to an abrupt stop with the following ...
    5. calling eruby from code?
      I've found documentation for running eruby(1) from the command line and for configuring Apache to handle eruby templates. Do you know how to...
  3. #2

    Default Re: fyi : rexml eruby cache'ing

    On Sat, 13 Sep 2003 11:55:19 +0900, paul vudmaska wrote:
    > now, instead, i do this
    > $globalFile = File.new('xml/global.xml')
    > $global = REXML::Document.new($globalFile)
    > $globalFile.close
    There are two Ruby idioms that you may prefer to this.

    1. File.open with a block:

    globalXML = nil
    File.open("xml/global.xml") do |f|
    globalXML = REXML::Document.new(f)
    end

    This implicitly closes the file at the end of the block.

    2. File.read:

    globalXML = REXML::Document.new(File.read("xml/global.xml"))

    -austin
    P.S. Top posting is the practice of replying before the quoted text. It is
    particularly frowned upon when the entire quoted message is included
    following the reply.
    --
    austin ziegler * [email]austin@halostatue.ca[/email] * Toronto, ON, Canada
    software designer * pragmatic programmer * 2003.09.13
    * 00.31.58




    Austin Ziegler Guest

  4. #3

    Default Re: fyi : rexml eruby cache'ing

    >>

    There are two Ruby idioms that you may prefer to this.

    1. File.open with a block:

    globalXML = nil
    File.open("xml/global.xml") do |f|
    globalXML = REXML::Document.new(f)
    end

    This implicitly closes the file at the end of the
    block.

    2. File.read:

    globalXML =
    REXML::Document.new(File.read("xml/global.xml"))
    <<

    Thanks for the tips! File.read, this will be ideal for
    me!



    __________________________________
    Do you Yahoo!?
    Yahoo! SiteBuilder - Free, easy-to-use web site design software
    [url]http://sitebuilder.yahoo.com[/url]

    paul vudmaska Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139