Sha256: cafc880b9029d7c1bee0d0de70f72907aa3683b04c99dca1244fa10591e8d519

Contents?: true

Size: 521 Bytes

Versions: 2

Compression:

Stored size: 521 Bytes

Contents

# frozen_string_literal: true

module EasyParams
  # Makes definition more compact
  # Do not use if your attributes have name like
  # integer, decimal, float, bool, string, array, date, datetime, time, struct
  module DSL
    def each(&block)
      array.of(struct_dsl, &block)
    end

    def has(&block)
      struct_dsl(&block)
    end

    def method_missing(method_name, *args, &block)
      public_send(:attribute, method_name, *args, &block)
    end

    def respond_to_missing?(*)
      true
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
easy_params-0.3.1 lib/easy_params/dsl.rb
easy_params-0.3.0 lib/easy_params/dsl.rb