repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
dinesh/mongo-memcached | lib/mongo_memcached/patches/_array.rb | <filename>lib/mongo_memcached/patches/_array.rb
class Array
alias_method :count, :size
def in_groups_of(number, fill_with = nil)
padding = (number - size % number) % number
collection = dup.concat([fill_with] * padding)
if block_given?
collection.each_slice(number) { |slice| yield(sli... |
dinesh/mongo-memcached | lib/mongo_memcached/patches/_mongoid.rb |
module Mongoid
module Document
include MongoMemcached
def shallow_clone
MongoMemcached::CachedDocument.new.tap do |other|
self.class.hot_fields.each{|name| other.attributes[name] = self.send(name).dup if self.class.hot?(name) }
other.id = self.id
other.klass = self.class
... |
dinesh/mongo-memcached | lib/mongo_memcached.rb | require 'mongo_memcached/patches/_array'
require 'mongo_memcached/patches/_symbol'
require 'mongo_memcached/membase'
require 'mongo_memcached/synchronize'
require 'mongo_memcached/index'
require 'mongo_memcached/cache_config'
Mongoid.configure do |config|
host = 'localhost'
config.master = Mongo::Connection.n... |
dinesh/mongo-memcached | lib/mongo_memcached/synchronize.rb | <filename>lib/mongo_memcached/synchronize.rb
module MongoMemcached
module Synchronize
def self.included base
base.class_eval do
include InstanceMethods
extend ClassMethods
end
end
module InstanceMethods
def self.included(mongo_class)
mongo_class.class_ev... |
dinesh/mongo-memcached | mongo-memcached.gemspec | <filename>mongo-memcached.gemspec
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{mongo-memcached}
s.version = "0.0.1"
s.required_rubygems_version = Gem::Requirement.new... |
dinesh/mongo-memcached | test/run.rb |
require 'helper'
require 'db'
require 'pp'
User.delete_all
Category.delete_all
types = ['hotel', 'nightlife', 'restaurant']
2.times do |i|
u = User.new(:name => "user_#{i}", :username => "username_#{i}", :admin => i%2, :age => i*10 )
1.times do |j|
u.categories.build(:name => 'cat_' + j.to_s , :system_typ... |
dinesh/mongo-memcached | lib/mongo_memcached/index.rb | <filename>lib/mongo_memcached/index.rb
module MongoMemcached
class Index
attr_accessor :collection, :attributes, :options, :membase
def initialize collection, attributes, opts = { :limit => 1000 }
@collection, @attributes, @options = collection, Array(attributes), opts.update(opts)
... |
dinesh/mongo-memcached | lib/mongo-memcached.rb | <gh_stars>1-10
require 'mongo_memcached'
|
dinesh/mongo-memcached | lib/mongo_memcached/patches/_symbol.rb |
class Symbol
include Comparable
def <=>(other)
self.to_s <=> other.to_s
end
end
class BSON::ObjectId
include Comparable
def <=>(other)
self.to_s <=> other.to_s
end
end
|
dinesh/mongo-memcached | lib/mongo_memcached/patches.rb |
require 'mongo_memcached/patches/_array'
require 'mongo_memcached/patches/_mongoid'
require 'mongo_memcached/patches/_symbol' |
dinesh/mongo-memcached | test/db.rb | <filename>test/db.rb<gh_stars>1-10
class User
include Mongoid::Document
field :name
field :username
field :age, :type => Integer
field :admin, :type => Boolean
references_many :categories, :foreign_key => :owner_id, :dependent => :destroy, :autosave => true
acts_as_memcached :name, :username, :contacts... |
dinesh/mongo-memcached | lib/mongo_memcached/cache_config.rb |
module MongoMemcached
class CacheConfig
attr_accessor :fields
def initialize _fields = []
@fields = Array(_fields).sort
end
def hot_fields
@fields
end
end
class CachedDocument
attr_accessor :attributes, :klass, :id, :parent
def initialize attr... |
jeefberkey/rspec-puppet | lib/rspec-puppet/coverage.rb | unless defined?(RSpec::Core::NullReporter)
module RSpec::Core
class NullReporter
def self.method_missing(*)
# ignore
end
private_class_method :method_missing
end
end
end
module RSpec::Puppet
class Coverage
attr_accessor :filters
class << self
extend Forwardable
... |
jeefberkey/rspec-puppet | spec/classes/relationship__titles_spec.rb | <filename>spec/classes/relationship__titles_spec.rb<gh_stars>0
require 'spec_helper'
describe 'relationships::titles' do
let(:facts) { {:operatingsystem => 'Debian', :kernel => 'Linux'} }
it { should compile }
it { should compile.with_all_deps }
it { should contain_file('/etc/svc') }
it { should contain_se... |
jeefberkey/rspec-puppet | spec/classes/test_windows_spec.rb | require 'spec_helper'
describe 'test::windows' do
let(:facts) { {:operatingsystem => 'windows' } }
it { should compile.with_all_deps }
end
|
jeefberkey/rspec-puppet | lib/rspec-puppet/tasks/release_test.rb | require 'rake'
require 'open3'
require 'json'
require 'parser/current'
task :release_test do
modules_to_test = [
'puppetlabs/puppetlabs-apt',
'puppetlabs/puppetlabs-tomcat',
'puppetlabs/puppetlabs-apache',
'puppetlabs/puppetlabs-mysql',
'puppetlabs/puppetlabs-ntp',
'puppetlabs/puppetlabs-acl'... |
emilio2601/hot-girl-summer | listening_history_service.rb | class ListeningHistoryService
def self.for(csv_file)
new(csv_file)
end
def initialize(csv_file)
@scrobbles = csv_file.map(&method(:parse_row)).compact
end
def parse_row(row_data)
artist, album, track_name, timestamp = row_data
return nil unless timestamp
dt_timestamp = DateTime.parse(ti... |
emilio2601/hot-girl-summer | generate_playlist.rb | <gh_stars>1-10
require "csv"
require "date"
require "rspotify"
require "dotenv/load"
require "./listening_history_service.rb"
SUMMER_START = DateTime.iso8601("2021-06-01")
SUMMER_END = DateTime.iso8601("2021-09-01")
SUMMER = SUMMER_START..SUMMER_END
INCLUSION_THRESHOLD = 25
PLAYLIST_ID = "04rbVkoutryqe1riHtYWTX"
SON... |
netuno-org/platform | bundle/base/apps/demo/server/services/samples/ruby/print-template.rb | <reponame>netuno-org/platform
#
# EN: RETURN THE CONTENT OF TEMPLATES
# EN: When you need to render HTML and keep the code simple and organized.
# EN: Check the contents of the folder server/templates/samples.
#
# PT: RETORNA O CONTEÚDO DE TEMPLATES
# EN: Quando precisa processar HTML e manter o código simples e ... |
netuno-org/platform | bundle/base/apps/demo/server/services/samples/ruby/query-parameter.rb |
#
# EN: EXECUTE A QUERY WITH PARAMETERS AND RETURN THE RESULT AS JSON
#
# PT: EXECUTA UMA QUERY COM PARÂMETROS E RETORNA O RESULTADO COMO JSON
#
_out.json(
_db.query(
'SELECT * FROM trabalhador '+
'WHERE id = ?::int AND nome like \'%\' || ?::varchar || \'%\' '+
'ORDER BY nome',
... |
netuno-org/platform | bundle/base/apps/demo/server/services/samples/ruby/query-result.rb | <filename>bundle/base/apps/demo/server/services/samples/ruby/query-result.rb<gh_stars>10-100
#
# EN: EXECUTE A QUERY AND RETURN THE RESULT AS JSON
#
# PT: EXECUTA UMA QUERY E RETORNA O RESULTADO COMO JSON
#
_out.json(
_db.query("SELECT uid, nome FROM trabalhador WHERE active = true")
)
|
netuno-org/platform | bundle/base/apps/demo/server/services/samples/ruby/user.rb | <filename>bundle/base/apps/demo/server/services/samples/ruby/user.rb
#
# EN: USER
# EN: Show information about the user logged.
#
# PT: UTILIZADOR
# PT: Apresenta a informação do utilizador logado.
#
data = _val.init()
data.set('title', 'This is your user data...')
data.set('id', _user.id)
data.set('name', _user... |
netuno-org/platform | bundle/base/apps/demo/server/services/samples/ruby/mail-send.rb |
#
# EN: MAIL SEND
# EN: Example of how to send email using a Google/GMail account.
# EN: Replace ***** with their account information.
# EN: You must set your mail configuration in config/_[environment].json, like:
#
# PT: ENVIAR E-MAIL
# PT: Exemplo de como enviar e-mail utilizando uma conta Google/GMail.
# PT... |
netuno-org/platform | bundle/base/apps/demo/server/services/samples/ruby/export-pdf.rb |
#
# EN: Export PDF
# EN: Generates a PDF file in realtime showing some kind of content features.
#
# PT: Export PDF
# PT: Gera um ficheiro PDF em tempo real mostrando alguns tipos de recursos de conteúdo.
#
_header.contentType('pdf')
pdfDocument = _pdf.newDocument(_pdf.pageSize('A4'));
viksiScript = _pdf.font(_... |
netuno-org/platform | bundle/base/apps/demo/server/services/samples/ruby/uid.rb |
#
# EN: UID / GUID
# EN: Generates an UID/GUID, a random unique identifier string.
#
# PT: UID / GUID
# PT: Gera um UID/GUID, uma string aleatório de identificação única.
#
_out.println(_uid.generate())
|
netuno-org/platform | bundle/base/apps/demo/server/services/samples/ruby/export-excel.rb |
#
# EN: Export EXCEL
# EN: Generates an Excel file in real time showing how to inject data,
# EN: use formulas, and apply graphic styles.
#
# PT: Export EXCEL
# PT: Gera um ficheiro Excel em tempo real mostrando como injetar dados,
# PT: utilizar fórmulas e aplicar estilos gráficos.
#
excel = _xls.create()
fon... |
netuno-org/platform | bundle/base/apps/demo/server/services/samples/ruby/print-lines.rb | <reponame>netuno-org/platform<gh_stars>10-100
#
# EN: RETURN LINES AS TEXT
#
# PT: RETORNA LINHAS COMO TEXTO
#
_header.contentType("text/plain")
_out.println("line number: 1")
_out.print("line number: ")
_out.print(2)
_out.println()
|
netuno-org/platform | bundle/base/apps/demo/server/services/samples/ruby/group.rb |
#
# EN: GROUP
# EN: Show information about the group of user logged.
#
# PT: GRUPO
# PT: Apresenta a informação do grupo do utilizador logado.
#
data = _val.init()
data.set('title', 'This is your group...')
data.set('id', _group.id)
data.set('name', _group.name)
data.set('code', _group.code)
data.set('full', _g... |
netuno-org/platform | bundle/base/apps/demo/server/services/samples/ruby/query-interaction.rb | <gh_stars>10-100
#
# EN: EXECUTE A QUERY WITH PARAMETER AND INTERACTION TO RESULT AS JSON
#
# PT: EXECUTA UMA QUERY COM PARÂMETROS E INTERAGE PARA RESULTAR COMO JSON
#
rows = _db.query(
"SELECT * FROM trabalhador "+
"WHERE id > ?::int AND active = true "+
"ORDER BY nome",
[ _req.getInt("id")... |
netuno-org/platform | bundle/base/apps/demo/server/services/samples/ruby/db.rb | <filename>bundle/base/apps/demo/server/services/samples/ruby/db.rb<gh_stars>10-100
#
# EN: Database Operations
# EN: Here you will found how simple is to manage database records.
#
# PT: Operações de Base de Dados
# PT: Aqui vai encontrará como é simples gerir os registos em dados na base.
#
#
# INSERT
#
_out... |
Radanisk/writeexcel | examples/properties.rb | <filename>examples/properties.rb
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
##############################################################################
#
# An example of adding document properties to a WriteExcel file.
#
# reverse('©'), August 2008, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# converted to... |
Radanisk/writeexcel | lib/writeexcel/write_file.rb | <filename>lib/writeexcel/write_file.rb
# -*- coding: utf-8 -*-
class WriteFile
def initialize
@data = ''
@datasize = 0
@limit = 8224
# Open a tmp file to store the majority of the Worksheet data. If this fails,
# for example due to write permissions, store the data in... |
Radanisk/writeexcel | examples/merge3.rb | #!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
###############################################################################
#
# Example of how to use WriteExcel to write a hyperlink in a
# merged cell. There are two options write_url_range() with a standard merge
# format or merge_range().
#
# reverse('©'), September 2... |
Radanisk/writeexcel | lib/writeexcel/worksheets.rb | <filename>lib/writeexcel/worksheets.rb<gh_stars>10-100
class Workbook < BIFFWriter
require 'writeexcel/properties'
require 'writeexcel/helper'
class Worksheets < Array
attr_accessor :activesheet
attr_writer :firstsheet
def initialize
@activesheet = nil
end
def activesheet_index
... |
Radanisk/writeexcel | examples/hyperlink.rb | #!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
###############################################################################
#
# Example of how to use the WriteExcel module to write hyperlinks
#
# See also hyperlink2.pl for worksheet URL examples.
#
# reverse('©'), March 2001, <NAME>, <EMAIL>
#
# original written in Perl... |
Radanisk/writeexcel | examples/chart_stock.rb | <reponame>Radanisk/writeexcel
#!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
#
###############################################################################
#
# A simple demo of Stock charts in Spreadsheet::WriteExcel.
#
# reverse('©'), January 2010, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# converted to R... |
Radanisk/writeexcel | test/test_24_txo.rb | # -*- coding: utf-8 -*-
##########################################################################
# test_24_txo.rb
#
# Tests for some of the internal method used to write the NOTE record that
# is used in cell comments.
#
# reverse('©'), September 2005, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# converte... |
Radanisk/writeexcel | lib/writeexcel/convert_date_time.rb | # -*- encoding: utf-8 -*-
module ConvertDateTime
#
# The function takes a date and time in ISO8601 "yyyy-mm-ddThh:mm:ss.ss" format
# and converts it to a decimal number representing a valid Excel date.
#
# Dates and times in Excel are represented by real numbers. The integer part of
# the number stores the ... |
Radanisk/writeexcel | examples/password_protection.rb | <gh_stars>10-100
require 'writeexcel'
workbook = WriteExcel.new('password_protection.xls')
worksheet = workbook.add_worksheet
# Create some format objects
locked = workbook.add_format(:locked => 1)
unlocked = workbook.add_format(:locked => 0)
hidden = workbook.add_format(:hidden => 1)
... |
Radanisk/writeexcel | test/test_big_workbook.rb | <filename>test/test_big_workbook.rb
# -*- coding: utf-8 -*-
require 'helper'
require 'stringio'
class TC_BigWorkbook < Test::Unit::TestCase
def test_big_workbook_saves
workbook = Workbook.new(StringIO.new)
4.times do
worksheet = workbook.add_worksheet
500.times {|i| worksheet.write_row(i, 0, [ra... |
Radanisk/writeexcel | examples/chart_legend.rb | #!/usr/bin/ruby
# -*- coding: utf-8 -*-
#
###############################################################################
#
# Chart legend visible/invisible sample.
#
# copyright 2013 <NAME>, <EMAIL>
#
require 'writeexcel'
# Create a new workbook called chart_legend.xls and add a worksheet
workbook = WriteExcel.new('... |
Radanisk/writeexcel | test/test_compatibility.rb | <reponame>Radanisk/writeexcel
# -*- coding: utf-8 -*-
require 'helper'
require 'nkf'
class TC_Compatibility < Test::Unit::TestCase
def test_ord
a = 'a'
abc = 'abc'
assert_equal(97, a.ord, "#{a}.ord faild\n")
assert_equal(97, abc.ord, "#{abc}.ord faild\n")
end
end
|
Radanisk/writeexcel | test/test_26_autofilter.rb | <reponame>Radanisk/writeexcel
# -*- coding: utf-8 -*-
##########################################################################
# test_26_autofilter.rb
#
# Tests for the internal methods used to write the AUTOFILTER record.
#
# reverse('©'), September 2005, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# conv... |
Radanisk/writeexcel | lib/writeexcel/embedded_chart.rb | <filename>lib/writeexcel/embedded_chart.rb
module Writeexcel
class Worksheet < BIFFWriter
require 'writeexcel/helper'
class EmbeddedChart
attr_reader :row, :col, :chart, :vertices
def initialize(worksheet, row, col, chart, x_offset = 0, y_offset = 0, scale_x = 1, scale_y = 1)
@worksheet = worksheet... |
Radanisk/writeexcel | examples/merge1.rb | #!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
###############################################################################
#
# Simple example of merging cells using the WriteExcel module.
#
# This merges three cells using the "Centre Across Selection" alignment.
# This was the Excel 5 method of achieving a merge. Use ... |
Radanisk/writeexcel | examples/protection.rb | <filename>examples/protection.rb
# -*- coding: utf-8 -*-
#!/usr/bin/ruby -w
########################################################################
#
# Example of cell locking and formula hiding in an Excel worksheet via
# the WriteExcel module.
#
# reverse('©'), August 2001, <NAME>, <EMAIL>
#
# original written i... |
Radanisk/writeexcel | examples/formula_result.rb | <gh_stars>10-100
#!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
#######################################################################
#
# Example of how to write Spreadsheet::WriteExcel formulas with a user
# specified result.
#
# This is generally only required when writing a spreadsheet for an
# application other than... |
Radanisk/writeexcel | examples/merge2.rb | <reponame>Radanisk/writeexcel
#!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
###############################################################################
#
# Simple example of merging cells using the WriteExcel module
#
# This merges two formatted cells using the "Centre Across Selection" alignment.
# This was the Exce... |
Radanisk/writeexcel | examples/defined_name.rb | <filename>examples/defined_name.rb
#!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
###############################################################################
#
# Example of how to create defined names in a WriteExcel file.
#
# reverse('ゥ'), September 2008, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# conve... |
Radanisk/writeexcel | lib/writeexcel/cell_range.rb | <reponame>Radanisk/writeexcel
module Writeexcel
class Worksheet < BIFFWriter
class CellRange
attr_accessor :row_min, :row_max, :col_min, :col_max
def initialize(worksheet)
@worksheet = worksheet
end
def increment_row_max
@row_max += 1 if @row_max
end
def increment_col_max
... |
Radanisk/writeexcel | examples/hyperlink2.rb | <filename>examples/hyperlink2.rb
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
###############################################################################
#
# Example of how to use the WriteExcel module to write internal and internal
# hyperlinks.
#
# If you wish to run this program and follow the hyperlinks you should c... |
Radanisk/writeexcel | lib/writeexcel/col_info.rb | module Writeexcel
class Worksheet < BIFFWriter
require 'writeexcel/helper'
class ColInfo
#
# new(firstcol, lastcol, width, [format, hidden, level, collapsed])
#
# firstcol : First formatted column
# lastcol : Last formatted column
# width : Col width in user units, 8.43 is defa... |
Radanisk/writeexcel | test/test_formula.rb | <reponame>Radanisk/writeexcel
# -*- coding: utf-8 -*-
require 'helper'
class TC_Formula < Test::Unit::TestCase
def setup
@formula = Writeexcel::Formula.new(0)
end
def test_scan
# scan must return array of token info
string01 = '1 + 2 * LEN("String")'
expected01 = [
[:NUMBER, '1'],
[... |
Radanisk/writeexcel | test/test_23_note.rb | <reponame>Radanisk/writeexcel
# -*- coding: utf-8 -*-
##########################################################################
# test_23_note.rb
#
# Tests for some of the internal method used to write the NOTE record that
# is used in cell comments.
#
# reverse('©'), September 2005, <NAME>, <EMAIL>
#
# original writt... |
Radanisk/writeexcel | examples/chart_pie.rb | <reponame>Radanisk/writeexcel<gh_stars>10-100
#!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
#
###############################################################################
#
# A simple demo of Pie chart in Spreadsheet::WriteExcel.
#
# reverse('ゥ'), December 2009, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# ... |
Radanisk/writeexcel | examples/chess.rb | <filename>examples/chess.rb
#!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
########################################################################
#
# Example of formatting using the Spreadsheet::WriteExcel module via
# property hashes.
#
# Setting format properties via hashes of values is useful when you have
# to deal ... |
Radanisk/writeexcel | test/test_write_formula_does_not_change_formula_string.rb | <filename>test/test_write_formula_does_not_change_formula_string.rb<gh_stars>10-100
# -*- coding: utf-8 -*-
require 'helper'
require 'writeexcel'
require 'stringio'
class TestWriteFormula < Test::Unit::TestCase
def setup
@workbook = WriteExcel.new(StringIO.new)
@worksheet = @workbook.add_worksheet('')
end
... |
Radanisk/writeexcel | test/test_01_add_worksheet.rb | # -*- coding: utf-8 -*-
require 'helper'
class TC_add_worksheet < Test::Unit::TestCase
def setup
@workbook = WriteExcel.new(StringIO.new)
end
def test_ascii_worksheet_name
name = "Test"
assert_nothing_raised {
sheet = @workbook.add_worksheet(name)
assert_equal name, sheet.name
}
... |
Radanisk/writeexcel | examples/diag_border.rb | #!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
##############################################################################
#
# A simple formatting example using WriteExcel.
#
# This program demonstrates the diagonal border cell format.
#
# reverse('©'), May 2004, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
#... |
Radanisk/writeexcel | examples/merge5.rb | <reponame>Radanisk/writeexcel<filename>examples/merge5.rb
#!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
###############################################################################
#
# Example of how to use the WriteExcel merge_cells() workbook
# method with complex formatting and rotation.
#
#
# reverse('©'), Septemb... |
Radanisk/writeexcel | examples/stats.rb | #!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
###############################################################################
#
# This is a simple example of how to use functions with the
# WriteExcel module.
#
# reverse('©'), March 2001, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# converted to Ruby by <NAME... |
Radanisk/writeexcel | test/test_25_position_object.rb | <filename>test/test_25_position_object.rb
# -*- coding: utf-8 -*-
###############################################################################
#
# A test for Spreadsheet::WriteExcel.
#
# Tests for the _position_object() Worksheet method used to calculate the
# vertices that define the position of a graphical object ... |
Radanisk/writeexcel | lib/writeexcel/olewriter.rb | # -*- coding: utf-8 -*-
###############################################################################
#
# BIFFwriter - An abstract base class for Excel workbooks and worksheets.
#
#
# Used in conjunction with WriteExcel
#
# Copyright 2000-2010, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# converted to Rub... |
Radanisk/writeexcel | examples/header.rb | #!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
######################################################################
#
# This program shows several examples of how to set up headers and
# footers with WriteExcel.
#
# The control characters used in the header/footer strings are:
#
# Control Category ... |
Radanisk/writeexcel | examples/store_formula.rb | <reponame>Radanisk/writeexcel
#!/usr/bin/env ruby
require 'writeexcel'
# Create a new workbook called simple.xls and add a worksheet
workbook = WriteExcel.new('store_formula.xls')
worksheet = workbook.add_worksheet()
formula = worksheet.store_formula('=A1 * 3 + 50')
(0 .. 999).each do |row|
worksheet.repeat_formu... |
Radanisk/writeexcel | test/test_21_escher.rb | <filename>test/test_21_escher.rb<gh_stars>10-100
# -*- coding: utf-8 -*-
###############################################################################
#
# A test for WriteExcel.
#
#
# all test is commented out because Workbook#add_mso_... was set to private
# method. Before that, all test passed.
#
#
#
#
# Tests for ... |
Radanisk/writeexcel | examples/set_first_sheet.rb | #!/usr/bin/ruby -w
# -*- coding:utf-8 -*-
require 'writeexcel'
workbook = WriteExcel.new('set_first_sheet.xls')
20.times { workbook.add_worksheet }
worksheet21 = workbook.add_worksheet
worksheet22 = workbook.add_worksheet
worksheet21.set_first_sheet
worksheet22.activate
workbook.close
|
Radanisk/writeexcel | test/test_60_chart_generic.rb | # -*- coding: utf-8 -*-
require 'helper'
require 'stringio'
###############################################################################
#
# A test for Chart.
#
# Tests for the Excel chart.rb methods.
#
# reverse(''), December 2009, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# converted to Ruby by <NAME... |
Radanisk/writeexcel | test/test_51_name_print_area.rb | # -*- coding: utf-8 -*-
##########################################################################
# test_51_name_print_area.rb
#
# Tests for the Excel EXTERNSHEET and NAME records created by print_are()..
#
# reverse('ゥ'), September 2008, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# converted to Ruby by <N... |
Radanisk/writeexcel | test/test_41_properties.rb | # -*- coding: utf-8 -*-
##########################################################################
# test_41_properties.rb
#
# Tests for OLE property sets.
#
# reverse('©'), September 2005, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# converted to Ruby by <NAME>, <EMAIL>
#
##################################... |
Radanisk/writeexcel | examples/comments2.rb | <reponame>Radanisk/writeexcel
#!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
###############################################################################
#
# This example demonstrates writing cell comments.
#
# A cell comment is indicated in Excel by a small red triangle in the upper
# right-hand corner of the cell.
#
... |
Radanisk/writeexcel | test/test_storage_lite.rb | # -*- coding: utf-8 -*-
require 'helper'
require 'stringio'
class TC_OLEStorageLite < Test::Unit::TestCase
TEST_DIR = File.expand_path(File.dirname(__FILE__))
PERL_OUTDIR = File.join(TEST_DIR, 'perl_output')
EXCEL_OUTDIR = File.join(TEST_DIR, 'excelfile')
def setup
@ole = OLEStorageLite.new
end
de... |
Radanisk/writeexcel | lib/writeexcel/storage_lite.rb | <reponame>Radanisk/writeexcel
# -*- coding: utf-8 -*-
#
# OLE::Storage_Lite
# by <NAME> (Hippo2000) 2000.11.4, 8, 14
# This Program is Still ALPHA version.
#//////////////////////////////////////////////////////////////////////////////
#
# converted from CPAN's OLE::Storage_Lite.
# converted to Ruby by <NAME>, <EMAIL>... |
Radanisk/writeexcel | test/test_format.rb | # -*- coding: utf-8 -*-
require 'helper'
require 'stringio'
class TC_Format < Test::Unit::TestCase
TEST_DIR = File.expand_path(File.dirname(__FILE__))
PERL_OUTDIR = File.join(TEST_DIR, 'perl_output')
def setup
@ruby_file = StringIO.new
@format = Writeexcel::Format.new
end
def test_set_format_pr... |
Radanisk/writeexcel | examples/chart_bar.rb | #!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
#
###############################################################################
#
# A simple demo of Bar chart in Spreadsheet::WriteExcel.
#
# reverse('・ゥ'), December 2009, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# converted to Ruby by <NAME>, <EMAIL>
#
requir... |
Radanisk/writeexcel | test/test_50_name_stored.rb | <gh_stars>10-100
# -*- coding: utf-8 -*-
##########################################################################
# test_50_name_stored.rb
#
# Tests for the Excel EXTERNSHEET and NAME records created by print_are()..
#
# reverse('ゥ'), September 2008, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# converte... |
Radanisk/writeexcel | utils/add_magic_comment.rb | #!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
require 'stringio'
#
# magic commentを付与する
#
# カレントディレクトリ以下の.rbファイルパスの配列を返す
def rb_files
Dir.glob("./**/*\.rb")
end
# カレントディレクトリ以下の.orgファイルパスの配列を返す
def org_files
Dir.glob("./**/*\.org")
end
# ファイル名を*.orgに変更し、変更後のファイル名を返す
def rename_to_org(file)
orgfile = change_ext_nam... |
Radanisk/writeexcel | examples/copyformat.rb | #!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
###############################################################################
#
# Example of how to use the format copying method with WriteExcel #
# reverse('©'), March 2001, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# converted to Ruby by <NAME>, <EMAIL>
#
re... |
Radanisk/writeexcel | test/test_02_merge_formats.rb | <reponame>Radanisk/writeexcel
# -*- coding: utf-8 -*-
require 'helper'
require 'stringio'
class TC_merge_formats < Test::Unit::TestCase
def setup
@workbook = WriteExcel.new(StringIO.new)
@worksheet = @workbook.add_worksheet
@merged_format = @workbook.add_format(:bold => 1)
... |
Radanisk/writeexcel | test/test_22_mso_drawing_group.rb | <gh_stars>10-100
# -*- coding: utf-8 -*-
##########################################################################
# test_22_mso_drawing_group.rb
#
# Tests for the internal methods used to write the MSODRAWINGGROUP record.
#
# all test is commented out because related method was set to
# private method. Before that, a... |
Radanisk/writeexcel | test/test_32_validation_dv_formula.rb | # -*- coding: utf-8 -*-
##########################################################################
# test_32_validation_dv_formula.rb
#
# Tests for the Excel DVAL structure used in data validation.
#
# reverse('©'), September 2005, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# converted to Ruby by <NAME>, <E... |
Radanisk/writeexcel | test/test_04_dimensions.rb | <filename>test/test_04_dimensions.rb
# -*- coding: utf-8 -*-
###############################################################################
#
# A test for WriteExcel.
#
# Check that the Excel DIMENSIONS record is written correctly.
#
# reverse('©'), October 2007, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
... |
Radanisk/writeexcel | examples/panes.rb | <reponame>Radanisk/writeexcel
#!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
#######################################################################
#
# Example of using the WriteExcel module to create worksheet panes.
#
# reverse('©'), May 2001, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# converted to Ruby b... |
Radanisk/writeexcel | test/test_05_rows.rb | <reponame>Radanisk/writeexcel
# -*- coding: utf-8 -*-
###############################################################################
#
# A test for WriteExcel.
#
# Check that max/min columns of the Excel ROW record are written correctly.
#
# reverse('©'), October 2007, <NAME>, <EMAIL>
#
# original written in Perl by <... |
Radanisk/writeexcel | test/test_31_validation_dv_strings.rb | <filename>test/test_31_validation_dv_strings.rb<gh_stars>10-100
# -*- coding: utf-8 -*-
##########################################################################
# test_31_validation_dv_strings.rb
#
# Tests for the packed caption/message strings used in the Excel DV structure
# as part of data validation.
#
# reverse(... |
Radanisk/writeexcel | examples/repeat.rb | # -*- coding: utf-8 -*-
#!/usr/bin/ruby -w
######################################################################
#
# Example of writing repeated formulas.
#
# reverse('©'), August 2002, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# converted to Ruby by <NAME>, <EMAIL>
#
require 'writeexcel'
workbook =... |
Radanisk/writeexcel | test/test_30_validation_dval.rb | <filename>test/test_30_validation_dval.rb
# -*- coding: utf-8 -*-
##########################################################################
# test_30_validation_dval.rb
#
# Tests for the Excel DVAL structure used in data validation.
#
# reverse('©'), September 2005, <NAME>, <EMAIL>
#
# original written in Perl by <NAM... |
Radanisk/writeexcel | test/test_40_property_types.rb | <filename>test/test_40_property_types.rb
# -*- coding: utf-8 -*-
##########################################################################
# test_40_property_types.rb
#
# Tests for the basic property types used in OLE property sets.
#
# reverse('©'), September 2005, <NAME>, <EMAIL>
#
# original written in Perl by <NAM... |
Radanisk/writeexcel | test/test_27_autofilter.rb | <filename>test/test_27_autofilter.rb<gh_stars>10-100
# -*- coding: utf-8 -*-
##########################################################################
# test_27_autofilter.rb
#
# Tests for the token extraction method used to parse autofilter expressions.
#
# reverse('©'), September 2005, <NAME>, <EMAIL>
#
# original w... |
Radanisk/writeexcel | charts/demo1.rb | <filename>charts/demo1.rb<gh_stars>10-100
#!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
###############################################################################
#
# Simple example of how to add an externally created chart to a Spreadsheet::
# WriteExcel file.
#
#
# This example adds a line chart extracted from the... |
Radanisk/writeexcel | test/test_13_date_seconds.rb | <reponame>Radanisk/writeexcel
# -*- coding: utf-8 -*-
###############################################################################
#
# A test for WriteExcel.
#
# Tests date and time second handling.
#
# reverse('©'), May 2004, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# converted to Ruby by <NAME>, <EMA... |
Radanisk/writeexcel | lib/writeexcel/charts/stock.rb | # -*- coding: utf-8 -*-
###############################################################################
#
# Stock - A writer class for Excel Stock charts.
#
# Used in conjunction with WriteExcel::Chart.
#
# See formatting note in WriteExcel::Chart.
#
# Copyright 2000-2010, <NAME>, <EMAIL>
#
# original written in Perl b... |
Radanisk/writeexcel | lib/writeexcel/charts/scatter.rb | <reponame>Radanisk/writeexcel
# -*- coding: utf-8 -*-
###############################################################################
#
# Scatter - A writer class for Excel Scatter charts.
#
# Used in conjunction with WriteExcel::Chart.
#
# See formatting note in WriteExcel::Chart.
#
# Copyright 2000-2010, <NAME>, <EMA... |
Radanisk/writeexcel | test/test_06_extsst.rb | # -*- coding: utf-8 -*-
###############################################################################
#
# A test for WriteExcel.
#
# all test is commented out because Workbook#calculate_extsst_size was set to
# private method. Before that, all test passed.
#
# Check that we calculate the correct bucket size and numbe... |
Radanisk/writeexcel | lib/writeexcel/worksheet.rb | <reponame>Radanisk/writeexcel
# -*- coding: utf-8 -*-
###############################################################################
#
# Worksheet - A writer class for Excel Worksheets.
#
#
# Used in conjunction with WriteExcel
#
# Copyright 2000-2010, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# converted... |
Radanisk/writeexcel | lib/writeexcel/outline.rb | module Writeexcel
class Worksheet < BIFFWriter
require 'writeexcel/helper'
class Outline
attr_accessor :row_level, :style, :below, :right
attr_writer :visible
def initialize
@row_level = 0
@style = 0
@below = 1
@right = 1
@visible = true
end
def ... |
Radanisk/writeexcel | examples/write_arrays.rb | <reponame>Radanisk/writeexcel
#!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
#######################################################################
#
# Example of how to use the WriteExcel module to
# write 1D and 2D arrays of data.
#
require 'writeexcel'
workbook = WriteExcel.new("write_arrays.xls")
worksheet1 = work... |
Radanisk/writeexcel | lib/writeexcel/shared_string_table.rb | class Workbook < BIFFWriter
require 'writeexcel/properties'
require 'writeexcel/helper'
class SharedString
attr_reader :string, :str_id
def initialize(string, str_id)
@string, @str_id = string, str_id
end
end
class SharedStringTable
attr_reader :str_total
def initialize
@sh... |
Radanisk/writeexcel | examples/bigfile.rb | #!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
###############################################################################
#
# Example of creating a WriteExcel that is larger than the
# default 7MB limit.
#
# It is exactly that same as any other WriteExcel program except
# that is requires that the OLE::Storage module... |
Radanisk/writeexcel | test/test_12_date_only.rb | # -*- coding: utf-8 -*-
###############################################################################
#
# A test for WriteExcel.
#
# Tests date and time handling. Tests dates in 1900 and 1904 format.
#
# reverse('©'), May 2004, <NAME>, <EMAIL>
#
# original written in Perl by <NAME>
# converted to Ruby by <NAME>, <EMA... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.