Sha256: 43517320484a67bdabaa407ad44cfd5824296eb9e5686890513a579f19df696e

Contents?: true

Size: 963 Bytes

Versions: 1

Compression:

Stored size: 963 Bytes

Contents

# frozen_string_literal: true

require "mockolate/parameters/attributes/parser"

module Mockolate::Parameters::Attributes
  # This module includes main macros definitions
  module Macros
    def self.included(base)
      base.extend ClassMethods
    end

    module ClassMethods
      include Mockolate::Parameters::Attributes::Parser
      
      # Handles single attribute which may have constant values
      # @param attr [String] key of attribute
      # @yield block
      def attribute(attr, &block)
        parse!(attr, &block)
        # class_variable_get(:@@_public_attributes).merge
      end

      # Handles multiple attributes
      # @param attrs [Array<String>] key of attribute
      def attributes(*attrs)
        parse!(attrs)
        # attr.each do |attr|
        #   return parse_hash(attr) if attr.is_a? Hash
        #   parse_symbol
        # end
        # class_variable_get(:@@_public_attributes).push *attrs
      end
    end
  end  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mockolate-0.0.0 lib/mockolate/parameters/attributes/macros.rb