首页 软件开发 代码片段 ruby ( Page 18 )

ruby 388

#Ruby
Ruby 编写一个 SOAP 客户端

require 'soap/rpc/driver' driver = SOAP::RPC::Driver.new( 'http://webservices.codingtheweb…

2015-05-14 960

#Ruby
Ruby 九九乘法表

(1..9).map{|a| (1..a).map{|b| "#{b}*#{a}=#{a*b}" }} .flatten => ["1*1=1", "1*2=2", "2*2…

2015-05-14 113

#Ruby
Ruby 的 YAML 简单示例

require 'yaml' class Person attr_accessor :name, :age end fred = Person.new fred.name = "F…

2015-05-13 791

#Ruby
在单双行显示不同的颜色

<%@items = [1,2,3,4]%> "row_class") -%>"> <% @items.each do |item| %> "c…

2015-05-11 629

#Ruby
ruby调用webservice的示例代码

require 'rubygems' require 'soap/wsdlDriver' url = "http://localhost:3001/hello_message/ws…

2015-05-07 163

#Ruby
使用 Soxer 创建第一个网页 Hello World

# Create all needed directories mkdir myapp myapp/lib myapp/public myapp/views myapp/conte…

2015-05-07 639

#Ruby
幽灵方法:动态生成方法

class Lawyer def method_missing(method, *args) puts "You called: #{method} (#{args.join(',…

2015-05-07 973

#Ruby
使用 wxRuby 创建 GUI 应用程序

#!/usr/bin/ruby -w require 'wxruby' class TroutApp < Wx::App def on_init frame = Wx::Fr…

2015-05-06 786

#Ruby
Ruby 多次调用远程对象的方法

require 'drb' class Counter attr_reader:count def initialize @count = 0 end def increment …

2015-05-04 355

#Ruby
Ruby 读取 HTML 页面参数

#!/ruby/bin/ruby require 'cgi' print "Content-type: text/html \n\n" cgi = CGI.new print "N…

2015-05-03 190

#Ruby
一个简单的可逆的ruby字符串加密解密算法

#encoding: utf-8 class Des require 'openssl' require 'base64' ALG = 'DES-EDE3-CBC' KEY = '…

2015-05-03 925

#Ruby
Ruby快速排序法

def partition(data, front, back) lastS1 = front pivot = data[front] frontUnknown = front +…

2015-05-02 539
1 16 17 18 19 20 33