Method: LibGems::Specification#pretty_print

Defined in:
lib/libgems/specification.rb

#pretty_print(q) ⇒ Object

:nodoc:



981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
# File 'lib/libgems/specification.rb', line 981

def pretty_print(q) # :nodoc:
  q.group 2, 'LibGems::Specification.new do |s|', 'end' do
    q.breakable

    attributes = @@attributes.sort_by { |attr_name,| attr_name.to_s }

    attributes.each do |attr_name, default|
      current_value = self.send attr_name
      if current_value != default or
         self.class.required_attribute? attr_name then

        q.text "s.#{attr_name} = "

        if attr_name == :date then
          current_value = current_value.utc

          q.text "Time.utc(#{current_value.year}, #{current_value.month}, #{current_value.day})"
        else
          q.pp current_value
        end

        q.breakable
      end
    end
  end
end