Sha256: 77f3abe25bf0c430e9e636474c5ea75e02dc59dc46d3acb85a15d3f9921309cb

Contents?: true

Size: 566 Bytes

Versions: 88

Compression:

Stored size: 566 Bytes

Contents

module Spreadsheet
  module Compatibility
    ##
    # One of the most incisive changes in terms of meta-programming in Ruby 1.9
    # is the switch from representing instance-variable names as Strings to
    # presenting them as Symbols. ivar_name provides compatibility.
    if RUBY_VERSION >= '1.9'
      def ivar_name symbol
        :"@#{symbol}"
      end
      def method_name symbol
        symbol.to_sym
      end
    else
      def ivar_name symbol
        "@#{symbol}"
      end
      def method_name symbol
        symbol.to_s
      end
    end
  end
end

Version data entries

88 entries across 88 versions & 7 rubygems

Version Path
spreadsheet-1.3.3 lib/spreadsheet/compatibility.rb
spreadsheet-1.3.2 lib/spreadsheet/compatibility.rb
spreadsheet-1.3.1 lib/spreadsheet/compatibility.rb
spreadsheet-1.3.0 lib/spreadsheet/compatibility.rb
spreadsheet-1.2.9 lib/spreadsheet/compatibility.rb
spreadsheet-1.2.8 lib/spreadsheet/compatibility.rb
spreadsheet-1.2.7 lib/spreadsheet/compatibility.rb
spreadsheet-1.2.6 lib/spreadsheet/compatibility.rb
spreadsheet-1.2.5 lib/spreadsheet/compatibility.rb
spreadsheet-1.2.4 lib/spreadsheet/compatibility.rb
spreadsheet-1.2.3 lib/spreadsheet/compatibility.rb
spreadsheet-1.2.2 lib/spreadsheet/compatibility.rb
spreadsheet-1.2.1 lib/spreadsheet/compatibility.rb
spreadsheet-1.2.0 lib/spreadsheet/compatibility.rb
spreadsheet-1.1.9 lib/spreadsheet/compatibility.rb
spreadsheet-1.1.8 lib/spreadsheet/compatibility.rb
spreadsheet-1.1.7 lib/spreadsheet/compatibility.rb
spreadsheet-1.1.6 lib/spreadsheet/compatibility.rb
spreadsheet-1.1.5 lib/spreadsheet/compatibility.rb
spreadsheet-1.1.4 lib/spreadsheet/compatibility.rb