dimanche 17 mars 2019

How to use my little class from ruby on ruby on rails

I have wrote one little class on ruby, and i want to use she, on ruby on rails, for showing on each pages, date and hours on french, how to be good placed, she on for having on each views ? if possible to explain, whole procees ? Many thanks, Here is she..

# Petite classe pour récupérer le jour et l'heure en Français

class JourFrancais

def initialize()
    self.jourj
end
def jourj
    jours_ouvrables = {Lundi: 'monday', Mardi: 'tuesday', Mercredi: 'wednesday', Jeudi: 'thursday', Vendredi: 'friday', Samedi: 'saturday', Dimanche: 'sunday'}


    jours_ouvrables.each do |key, value|
        if Time.now.strftime("%A").downcase == value
        puts "Nous sommes le #{key} " + Time.now.strftime("%d/%m/%Y") + " et il est " + Time.now.strftime("%H:%M")

        end
    end
end end

thanks for your help..

Aucun commentaire:

Enregistrer un commentaire