Sha256: 185d5b289176b7a7ac9c6ec1aa646250fa707bd478d6b27470488067465f5071

Contents?: true

Size: 573 Bytes

Versions: 11

Compression:

Stored size: 573 Bytes

Contents

module Remarkable # :nodoc:
  module Private # :nodoc:    
    # Returns the model class constant, as determined by the test class name.
    def subject_class
      # TODO: fazer um mixin na classe de string para retornar o formato do variable_name
      variable_name = "@#{instance_variable_name}"
      if instance_variable_defined?(variable_name)
        instance_variable_get(variable_name)
      else
        self.class.described_type
      end
    end

    def instance_variable_name
      self.class.described_type.to_s.split(':').last.underscore
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
carlosbrando-remarkable-2.2.1 lib/remarkable/private_helpers.rb
carlosbrando-remarkable-2.2.10 lib/remarkable/private_helpers.rb
carlosbrando-remarkable-2.2.3 lib/remarkable/private_helpers.rb
carlosbrando-remarkable-2.2.4 lib/remarkable/private_helpers.rb
carlosbrando-remarkable-2.2.5 lib/remarkable/private_helpers.rb
carlosbrando-remarkable-2.2.6 lib/remarkable/private_helpers.rb
carlosbrando-remarkable-2.2.7 lib/remarkable/private_helpers.rb
carlosbrando-remarkable-2.2.8 lib/remarkable/private_helpers.rb
carlosbrando-remarkable-2.2.9 lib/remarkable/private_helpers.rb
carlosbrando-remarkable-2.3.0 lib/remarkable/private_helpers.rb
carlosbrando-remarkable-2.3.1 lib/remarkable/private_helpers.rb