Sha256: a10a744ea5adaacae5ad0e2130eecf423f4d25e751388207eb9ebd023631d638

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

#! /bin/usr/env ruby

# HelloWorldFizzBuzz
module HelloWorldFizzBuzz
  # Sqlite database Module
  module Sqlite
    def connect_database
      @db = Sequel.sqlite

# create an items table
begin
  @db.create_table :list do
    primary_key :id
    String :language
    String :helloworld
    String :fizzbuzz
  end
end
   # create a dataset from the items table
   @posts = @db[:list]

# populate the table

## Add hello-world && fizz-buzz examples Below (In Alphabetic Order)

### A

### B

### C

### D

### E

### F

### G

### H

### I

### J

### K

### L

### M

### N

### O

### P
@posts.insert(language: 'php',
              helloworld: "<?php
print('Hello World');
?>",
              fizzbuzz: "
for ($i = 1; $i <= 100; $i++)
{
    if($i % 3 == 0 && $i % 5 ==0){
        echo 'FizzBuzz<br />';
    }
    else if($i % 3 == 0){
        echo 'Fizz<br />';
    }
    else if($i % 5 == 0){
        echo 'Buzz<br />';
    }
    else {
        echo $i.'<br />'';
    }
}
")

### Q

### R
@posts.insert(language: 'ruby',
              helloworld: "puts 'Hello, world!'",
              fizzbuzz: "
def fizzbuzz(n)
  (1..n).each do |i|
    if i % 3 == 0 && i % 5 == 0
      puts 'fizzbuzz'
    elsif i % 3 == 0
      puts 'fizz'
    elsif i % 5 == 0
      puts 'buzz'
    else
      puts i
    end
  end
end

fizzbuzz(100)")

### S

### T

### U

### V

### W

### X

### Y

### Z
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
HelloWorldFizzBuzz-0.1.3 lib/HelloWorldFizzBuzz/sqlite.rb