Class: FriendlyRoutes::Params::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/friendly_routes/params/base.rb

Direct Known Subclasses

BooleanParams, CollectionParams, HashParams

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, name, optional) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
# File 'lib/friendly_routes/params/base.rb', line 8

def initialize(type, name, optional)
  @type = type
  @name = name
  @optional = optional
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/friendly_routes/params/base.rb', line 6

def name
  @name
end

#typeObject

Returns the value of attribute type.



6
7
8
# File 'lib/friendly_routes/params/base.rb', line 6

def type
  @type
end

Instance Method Details

#constraintsObject

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/friendly_routes/params/base.rb', line 18

def constraints
  raise NotImplementedError
end

#optional?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/friendly_routes/params/base.rb', line 14

def optional?
  @optional == true
end