Skip to content

Instantly share code, notes, and snippets.

View Fokusnica's full-sized avatar

Liubov Derevianko Fokusnica

  • Kharkiv, Ukraine
View GitHub Profile
@Fokusnica
Fokusnica / email_notification.rb
Last active August 29, 2015 14:24
email_notification
def email_notification_params
{
penalty: ((reader_with_book.book.penalty_per_hour + 0.005)* 100).to_i / 100.0,
hours_to_deadline: ((issue_datetime.to_i - Time.now.to_i) / 3600) ,
reader_name: reader_with_book.name ,
book_tit: reader_with_book.book.title ,
book_aut: reader_with_book.book.author.name
@Fokusnica
Fokusnica / book
Created June 27, 2015 17:10
Additional practice Book
class Book
# attr_accessor :author_name, :book_title
attr_writer :author_name, :book_title
attr_reader :author_name, :book_title
def initialize (author_name = nil, book_title = nil)
@author_name = author_name.to_s
@book_title = book_title.to_s
end
@Fokusnica
Fokusnica / edition
Created June 27, 2015 17:10
Additional practice Edition
class Edition
# :book, :year_of_publishing, :number_of_pages
attr_writer :book, :year_of_publishing, :number_of_pages
attr_reader :book, :year_of_publishing, :number_of_pages
def initialize (book = nil, year_of_publishing = nil, number_of_pages = nil)
@book =book.to_s
@year_of_publishing=year_of_publishing.to_i
@number_of_pages = number_of_pages.to_i
@Fokusnica
Fokusnica / Author
Created June 27, 2015 17:09
Additional practice Author
class Author
#attr_accessor :name, :year_of_birth, :year_of_death
attr_writer :name, :year_of_birth, :year_of_death
attr_reader :name, :year_of_birth, :year_of_death
def initialize(name = nil, year_of_birth = nil, year_of_death = nil)
@name = name.to_s
@year_of_birth = year_of_birth.to_i
@year_of_death = year_of_death.to_i