Class: Dao::Params

Inherits:
Map
  • Object
show all
Includes:
Validations
Defined in:
lib/dao/params.rb

Constant Summary

Constants included from Validations

Validations::ClassMethods, Validations::InstanceMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Validations

add, for, included, new

Constructor Details

#initialize(*args, &block) ⇒ Params

Returns a new instance of Params.



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/dao/params.rb', line 19

def initialize(*args, &block)
  options = Dao.options_for!(args)

  @path = args.shift || options[:path] || Path.default
  @route = options[:route] || Route.default
  @form = options[:form] || Form.for(self)

  update(options[:params]) if options[:params]

  super
end

Instance Attribute Details

#formObject

Returns the value of attribute form.



17
18
19
# File 'lib/dao/params.rb', line 17

def form
  @form
end

#pathObject

instance methods



15
16
17
# File 'lib/dao/params.rb', line 15

def path
  @path
end

#routeObject

Returns the value of attribute route.



16
17
18
# File 'lib/dao/params.rb', line 16

def route
  @route
end

Instance Method Details

#attributesObject



31
32
33
# File 'lib/dao/params.rb', line 31

def attributes
  self
end

#inspectObject

look good for inspect



39
40
41
# File 'lib/dao/params.rb', line 39

def inspect
  Dao.json_for(self)
end

#update(*args, &block) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/dao/params.rb', line 48

def update(*args, &block)
  if args.size==1 and args.first.respond_to?(:to_dao)
    to_dao = args.first.to_dao
    return super(to_dao)
  end
  super
end