Skip to content

Evitar chamadas ao .each_pair e ao .each no @tmp se ele estiver vazio? #5

@thiagofm33

Description

@thiagofm33

Pessoal, seria uma boa evitar chamadas ao .each_pair e ao .each no @tmp se ele estiver vazio?

def initialize(data = {})
@tmp = data
handle_errors_and_messages
define_accessors
end

Tava pensando que algo assim poderia ficar bacana.

    def initialize(data = {})
      @tmp = data

      handle_data if data.any?
    end

    def handle_data
      handle_errors_and_messages
      define_accessors
    end

Que acham, @petlove/ecommerce?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions