Ruby to Jruby

hi i need some help, i am new to jruby and i have made a little database
script in ruby but i want it to be in a nice jruby inviroment so please
can somebody help me.

here’s my script: (don’t steal it)
class SomeDataProcessing
Person = Struct.new :name, :last_name, :phone_number, :birthday,
:city, :adress
def self.openOn(p_file)
new(p_file)
end
def initialize(p_file)
@file = p_file
@persons = {}
loadData
end
def choose
loop do
puts “PPID”
puts “Personal: Person Info Database”
puts “( a(dd) / l(ist) / n(ame) / q(uit) )”
answer = gets.chomp.slice(0,1)
case answer
when “a”
puts “”
Class_new.new
when “l”
puts “”
listData
when “n”
puts “”
puts “Name of person:”
name = gets.chomp.capitalize
puts “”
showData(name)
when “q”
exit
else
puts “Please awnser a[dd], l[ist], n[ame] or q[uit]”
puts “”
end
end
end
def listData
@persons.keys.sort.each {|p| showData§}
end
def loadData
File.foreach(@file) do |line|
name, last_name, phone_number, birthday, city, adress =
line.chomp.split(",")
@persons[name] = Person.new(name, last_name, phone_number,
birthday, city, adress)
end
end
def showData(p_name)
person = @persons[p_name]
if person.nil?
then
puts “#{p_name} not in database.”
return
end
puts “Name: #{person.name} #{person.last_name}”
puts “Phonenumber: #{person.phone_number}”
puts “Birthday: #{person.birthday}”
puts “City: #{person.city}”
puts “Adress: #{person.adress}”
puts “”
end
end

class Class_new
def initialize
puts “Name:”
@name = gets.chomp.capitalize
puts “Lastname:”
@lastname = gets.chomp.capitalize
puts “Phonenumber:”
@phonenumber = gets.chomp.capitalize
puts “Birthday:”
puts " Month:"
month = gets.chomp.capitalize
case month
when “1”
@month = “January”
when “2”
@month = “February”
when “3”
@month = “March”
when “4”
@month = “April”
when “5”
@month = “May”
when “6”
@month = “June”
when “7”
@month = “July”
when “8”
@month = “August”
when “9”
@month = “September”
when “10”
@month = “October”
when “11”
@month = “November”
when “12”
@month = “December”
else
end
puts " Day:"
@day = gets.chomp
puts " Year:"
@year = gets.chomp
puts “City:”
@city = gets.chomp.capitalize
puts “Adress:”
puts " Streetname:"
@streetname = gets.chomp.capitalize
puts " Housenumber:"
@housenumber = gets.chomp.capitalize
puts “”
show_data
end
def show_data
puts “Name: #{@name} #{@lastname}”
puts “Callname: #{@phonenumber}”
puts “Birthday: #{@month}-#{@day}-#{@year}”
puts “City: #{@city}”
puts “Adress: #{@streetname} #{@housenumber}”
puts “”
save_data
end
def save_data
puts “Save data?”
puts “Yes / No”
@choose2 = gets.chomp
if @choose2 == “yes”
puts “”
write_data
elsif @choose2 == “no”
puts “”
else
puts “”
puts “Please enter Yes / No”
puts “”
save_data
end
end
def write_data
open(‘PPIDdata.txt’, ‘a+’) { |f|
f.puts
“#{@name},#{@lastname},#{@phonenumber},#{@month}-#{@day}-#{@year},#{@city},#{@streetname}
#{@housenumber}”}
puts “Succesfully saved!!”
puts “”
end
end

dp = SomeDataProcessing.openOn(“PPIDdata.txt”)
dp.choose

thanks

lark

On Sat, Nov 20, 2010 at 4:29 AM, Lark W. [email protected] wrote:

hi i need some help, i am new to jruby and i have made a little database
script in ruby but i want it to be in a nice jruby inviroment so please
can somebody help me.

So what happens when you run your script with JRuby? Do you get
an error? Is there an actual question here?

–
Hassan S. ------------------------ [email protected]
twitter: @hassan

no i don’t get a error but i don’t get jruby so maybe someone can put it
toghter

On Sat, Nov 20, 2010 at 4:53 AM, Lark W. [email protected] wrote:

no i don’t get a error but i don’t get jruby so maybe someone can put it
toghter

What do you mean “don’t get jruby”?? What are you expecting?

–
Hassan S. ------------------------ [email protected]
twitter: @hassan

i recently starting to learn ruby and i got this script but now i want a
nice intervace with jruby and i need help with that

On Sat, Nov 20, 2010 at 4:59 AM, Lark W. [email protected] wrote:

i recently starting to learn ruby and i got this script but now i want a
nice intervace with jruby and i need help with that

Are you saying you want to change your script to have a GUI rather
than a command-line interface?

If so, I suggest you google ‘jruby GUI’ and start working through that
list of possibilities :slight_smile:

–
Hassan S. ------------------------ [email protected]
twitter: @hassan

yes that but i have done research and i don’t get it that’s why i have
come here

to make the intervace how to make the buttons and that shit

On Sat, Nov 20, 2010 at 5:08 AM, Lark W. [email protected] wrote:

yes that but i have done research and i don’t get it that’s why i have
come here

You “don’t get” what? What have you tried?

–
Hassan S. ------------------------ [email protected]
twitter: @hassan

what toolkit??

On Sat, Nov 20, 2010 at 5:52 AM, Lark W. [email protected] wrote:

to make the intervace how to make the buttons and that shit

Pick a toolkit, read the documentation.

Good luck!

Hassan S. ------------------------ [email protected]
twitter: @hassan

On Sat, Nov 20, 2010 at 6:05 AM, Lark W. [email protected] wrote:

what toolkit??

The one you found googling “JRuby GUI”.

–
Hassan S. ------------------------ [email protected]
twitter: @hassan

can u please give me a link on something, and i am working on netbeans

alright i have looked at it now for a long time and i don’t get it can
someone please make it for me please???

On Sat, Nov 20, 2010 at 7:55 AM, Lark W. [email protected] wrote:

alright i have looked at it now for a long time and i don’t get it can
someone please make it for me please???

Sure, no problem – will that be Visa or MasterCard? :slight_smile:

–
Hassan S. ------------------------ [email protected]
twitter: @hassan

alright than not:P