This file contains hidden or 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 Dog | |
attr_accessor :age | |
def initialize(age) | |
self.age = age | |
end | |
end | |
d = Dog.new(8) | |
puts d.age |
This file contains hidden or 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 Dog | |
attr_reader :age | |
def initialize(age) | |
@age = age | |
end | |
end | |
d = Dog.new(8) | |
puts d.age |
This file contains hidden or 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..gets.to_i).each do |i| | |
(0...(str = gets.to_s.downcase).length).each do |j| | |
if str[j] == 'a' | |
str[j] = 'y' | |
elsif str[j] == 'b' | |
str[j] = 'h' | |
elsif str[j] == 'c' | |
str[j] = 'e' | |
elsif str[j] == 'd' | |
str[j] = 's' |
This file contains hidden or 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
def pair(a, b) | |
total = 0 | |
(a...b).each do |n| | |
((n+1)..b).each do |m| | |
(0...n.to_s.length).each do |i| | |
temp = n.to_s[i, n.to_s.length] + n.to_s[0, i] | |
if temp == m.to_s | |
total += 1 | |
end | |
end |
This file contains hidden or 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
MOZILLA: | |
NoMethodError in Home#index | |
Showing /home/pankoholic/code/rehearsals/app/views/layouts/header.html.erb where line #17 raised: | |
undefined method `is_musician?' for nil:NilClass | |
Extracted source (around line #17): | |
14: <%= link_to "Sign in", "/sign_in" %> |