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 MyClass | |
def method_1 | |
puts 'This is a public method' | |
end | |
def method_2 | |
puts 'This is a public method' | |
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 SpaceShip | |
# Combines attr_reader and attr_writer | |
attr_accessor :destination | |
# Define multiple accessors | |
attr_accessor :insulation, :parachutes | |
attr_reader :name | |
attr_writer :name | |
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 SpaceShip | |
attr_accessor :destination | |
end | |
# Behind the scenes | |
class SpaceShip | |
# Getter | |
def destination | |
@destination | |
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
require './cars' | |
class Car | |
def initialize(data) | |
data.each do |key, value| | |
self.class.add_attribute(key,value) | |
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
# Source | |
# https://github.com/vega/vega/blob/master/docs/data/cars.json | |
FORD_MAVERICK_DATA = { | |
Name: "ford maverick", | |
Miles_per_Gallon: 21, | |
Cylinders: 6, | |
Displacement: 200, | |
Horsepower: 85, | |
Weight_in_lbs: 2587, |
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
require './cars' | |
class Ford | |
attr_reader :Name, :Origin | |
def initialize(data) | |
@Name = data[:Name] | |
@Origin = data[:Origin] | |
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
FORD_MAVERICK_DATA = { | |
Name: "ford maverick", | |
Miles_per_Gallon: 21, | |
Cylinders: 6, | |
Displacement: 200, | |
Horsepower: 85, | |
Weight_in_lbs: 2587, | |
Acceleration: 16, | |
Year: "1970-01-01", | |
Origin: "USA", |
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
-- Find An SP Containing text | |
SELECT name, | |
OBJECT_DEFINITION(object_id) | |
FROM sys.procedures | |
WHERE OBJECT_DEFINITION(object_id) | |
LIKE '%user-request%'; | |
-- Find An SP Containing text | |
-- Using System Information schema View | |
SELECT ROUTINE_NAME, |
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
-- Find SP By Name | |
SELECT | |
name | |
FROM | |
sys.procedures | |
WHERE | |
name LIKE '%request%' | |
-- Find SP via System Information schema View | |
SELECT |
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
-- Find Table By Name | |
SELECT * | |
FROM sys.tables | |
WHERE name LIKE '%request%'; | |
-- Find Table From All Databases By Name | |
EXEC sys.sp_MSforeachdb | |
'SELECT ''?'' DatabaseName, Name | |
FROM [?].sys.Tables | |
WHERE Name |