Skip to content

Instantly share code, notes, and snippets.

Pasha Bratanov zgfif

Block or report user

Report or block zgfif

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View program4_validation.rb
require 'active_model'
class Person
include ActiveModel::Validations
attr_accessor :name, :age
def initialize(name: nil, age: nil)
@name = name
@age = age
View program2_animal.rb
class Animal
attr_reader :distance
def initialize
@distance = 0
def step!
@distance += 1
zgfif / program1.rb
Created Dec 15, 2018
Реалізувати програму, яка буде приймати аргументом рядок (String) і рахувати скільки разів зустрічається кожна літера в цьому рядку.
View program1.rb
def count_letters(text)
array = []
text = text.downcase
text.each_char do |char|
if char =~ /[A-Za-z]+/
count = text.count(char)
array << [char, count]
array = array.uniq
You can’t perform that action at this time.