class Sesc::Exporter::Events
Constants
- ATTRIBUTES
Public Class Methods
print(sescs)
click to toggle source
# File lib/sesc/exporter/events.rb, line 11 def print(sescs) sescs.each do |sesc, events| events.each do |event| print_event_for(sesc, event) if availability?(event) end end end
Private Class Methods
age_limit(event)
click to toggle source
# File lib/sesc/exporter/events.rb, line 56 def age_limit(event) pprint paint('Classificação: ') + paint(event[:age_limit], yellow) end
availability?(event)
click to toggle source
# File lib/sesc/exporter/events.rb, line 52 def availability?(event) event[:availability] != 'Esgotado' end
date(event)
click to toggle source
# File lib/sesc/exporter/events.rb, line 44 def date(event) pprint paint('Datas: ') + paint(event[:date], yellow) end
description(event)
click to toggle source
# File lib/sesc/exporter/events.rb, line 36 def description(event) pprint paint('Descrição: ') + paint(event[:description], yellow) end
hours(event)
click to toggle source
# File lib/sesc/exporter/events.rb, line 60 def hours(event) pprint paint('Horários: ') + paint(event[:hours], yellow) end
paint(text, options = {})
click to toggle source
# File lib/sesc/exporter/events.rb, line 72 def paint(text, options = {}) Sesc::Exporter::Painter.new(text, options).default end
place(sesc)
click to toggle source
# File lib/sesc/exporter/events.rb, line 40 def place(sesc) pprint paint('Local: ') + paint(sesc, yellow) end
pprint(line, up: 0)
click to toggle source
# File lib/sesc/exporter/events.rb, line 68 def pprint(line, up: 0) Sesc::Exporter::Printer.new(line, up: up).terminal end
price(event)
click to toggle source
# File lib/sesc/exporter/events.rb, line 48 def price(event) pprint paint('Preço: ') + paint(event[:price], yellow) end
print_event_for(sesc, event)
click to toggle source
# File lib/sesc/exporter/events.rb, line 21 def print_event_for(sesc, event) title(event) description(event) place(sesc) date(event) price(event) hours(event) age_limit(event) url(event) end
title(event)
click to toggle source
# File lib/sesc/exporter/events.rb, line 32 def title(event) pprint paint(event[:title], color: :blue), up: 1 end
url(event)
click to toggle source
# File lib/sesc/exporter/events.rb, line 64 def url(event) pprint paint(Sesc::Config.base_url + event[:url]) end
yellow()
click to toggle source
# File lib/sesc/exporter/events.rb, line 76 def yellow { color: :yellow } end