Module: EasyParams::DSL

Defined in:
lib/easy_params/dsl.rb

Overview

Makes definition more compact Do not use if your attributes have name like integer, decimal, float, bool, string, array, date, datetime, time, struct

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



16
17
18
# File 'lib/easy_params/dsl.rb', line 16

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

Instance Method Details

#each(&block) ⇒ Object



8
9
10
# File 'lib/easy_params/dsl.rb', line 8

def each(&block)
  array.of(struct_dsl, &block)
end

#has(&block) ⇒ Object



12
13
14
# File 'lib/easy_params/dsl.rb', line 12

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

#respond_to_missing?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/easy_params/dsl.rb', line 20

def respond_to_missing?(*)
  true
end