Displaying the calenday day
It looks like you want to create some helper functions as class methods.  If you do that, you probably want to use class variables (e.g. @@a) rather than instance variables.  I would like to suggest what I think may be a better way. 

First, convert the instance variables you created with attr_accessor to class instance variables (not to be confused with class variables).  You can do that like this:

class CalendarDay
  class &lt;&lt; self
    attr_accessor :from_month, :to_month, :year

    def line_of_day_numbers(month,year,start,offset)
      ...
      @sugar = 7
      x = 5
      @year = ..... 
      ...
    end
  end 
end


Now you can use CalendarDay.from_month. CalendarDay.year = 2007, and so on.  Here class &lt;&lt; self is opening CalendarDay's singleton class or metaclass.  (To be more precise, it sets self to that metaclass.)  You could add other class instance variables (@sugar), as well as local variables (x).  You can also add class instance methods, as I have done above.  You would invoke this method with:

CalendarDay.line_of_day_numbers(month,year,start,offset)


Notice that self. is not used in defining class instance methods.  That's because self is the class's metaclass when they are created.

Note that these are class instance variables and class instance methods, not class variables or instance variables or class methods or instance methods.  They are only available to the class object, CalendarDays.  If you were to create an instance of the class, cal_day = CalendarDay.new, you'd find cal_day would have no access to any of these class instance variables or class instance methods.

One of the nice things about doing it this way is that you can write your code between class &lt;&lt; self and end in the same way you'd write code for a class instance.  All instance variables, local variables and instance methods are available to the class only.

For the record, there are a few (equivalent) alternatives to the class &lt;&lt; self/end construct.  One is:

module CalendarDayModule
  attr_accessor :from_month, :to_month, :year

  def line_of_day_numbers(month,year,start,offset)
      ...
  end
end

class CalendarDay
  extend CalendarDayModule
end


I discussed that here. 

Beyond this, I can make no suggestions for improving your code without seeing more of it, day_numbers() in particular.  BTW, within your line_of_day_numbers() class method, neither  first_line_padding() nor day_numbers() need be preceded by self..