Using a C program inside of Rails

Hi,

I have a compiled c program I use to do text processing.

It operates as a pipe:

cat sometext.txt | /usr/local/bin/my_c_program > othertext.txt

I want to use it to process text which is typed into
a textarea field in an HTML form.

What are some options I have to make use of this
executable so I could use it as a text filter inside
of Rails?

-Dan

On 9/30/06, Dan B. [email protected] wrote:

a textarea field in an HTML form.

What are some options I have to make use of this
executable so I could use it as a text filter inside
of Rails?

Try Kernel#popen
[http://corelib.rubyonrails.org/classes/IO.html#M001289].

-ryan

I’m writing tests and want to move my development data into my test
db. I do a “rake db:data:dump MODEL=My_modelname” and get a fixtures
file that looks like this:

  • !ruby/object:My_modelname
    attributes:
    name: nil
    notes:
    id: “1”
    state:
  • !ruby/object:My_modelname
    attributes:
    name: rdfadd
    notes:
    id: “2”
    state:
    .
    .
    .
    etc

This format is rejected by the fixtures() method. To get it to work I
have to take four (!) manual steps:

  • erase the leading “–” line
  • erase the “- !ruby/object:My_modelname” lines
  • erase the leading double-space before “attributes”
  • give each fixture record a unique name

So when I’m done it looks like this:

rec_1:
name: nil
notes:
id: “1”
state:
rec_2:
name: rdfadd
notes:
id: “2”
state:

I thought the whole point was the the dump makes YML files that can
go straight into testing? Am I doing something wrong?

Thanks!
-Jason