This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package float_test | |
import ( | |
"database/sql" | |
"testing" | |
"github.com/go-pg/pg/v10" | |
_ "github.com/go-pg/pg/v10/orm" | |
"github.com/jackc/pgx/v4" | |
"github.com/jackc/pgx/v4/stdlib" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
class << self | |
private | |
def bar | |
puts 'Class method called' | |
end | |
end | |
def self.baz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
private | |
def self.bar | |
puts 'Not-so-private class method called' | |
end | |
end | |
Foo.bar # => "Not-so-private class method called" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
def self.bar=(value) | |
@foo = value | |
return 'OK' | |
end | |
end | |
Foo.bar = 3 # => 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'foo'.upcase! # => "FOO" | |
'FOO'.upcase! # => nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MY_SCOPE = 'Global' | |
module Foo | |
MY_SCOPE = 'Foo Module' | |
class Bar | |
def scope1 | |
puts MY_SCOPE | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BangBang < Exception | |
end | |
begin | |
raise BangBang | |
rescue | |
puts 'Caught it!' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
def show | |
puts 'Foo#show' | |
end | |
end | |
class Bar < Foo | |
def show(text) | |
super | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 == 1.0 # => true | |
1.eql? 1.0 # => false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(surprise = true) and false # => surprise is true | |
surprise = (true && false) # => surprise is false |
NewerOlder