Sha256: 897ff89f16ba2fbfb2427088269d199c0c95ed3227b5de97855cb498f58bc1f7

Contents?: true

Size: 387 Bytes

Versions: 1

Compression:

Stored size: 387 Bytes

Contents

module NamedAccessors
  module Utilities
    private
    def getter_name(options)
      extract_as_option(options)
    end

    def setter_name(options)
      :"#{extract_as_option(options)}="
    end

    def extract_as_option(options)
      options.fetch(:as) rescue raise "You must specify `as` option"
    end

    def instance_variable_name(name)
      :"@#{name}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
named_accessors-1.0 lib/named_accessors/utilities.rb