Class: Fugle::HTTP::Parameters Private

Inherits:
Object
  • Object
show all
Defined in:
lib/fugle/http/parameters.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

Instance Method Summary collapse

Constructor Details

#initializeParameters

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Parameters.

Since:

  • 0.1.0



10
11
12
# File 'lib/fugle/http/parameters.rb', line 10

def initialize
  @items = []
end

Instance Method Details

#[](name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



33
34
35
# File 'lib/fugle/http/parameters.rb', line 33

def [](name)
  @items.find { |item| item[:name] == name }
end

#add(name, options = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



16
17
18
19
20
21
22
# File 'lib/fugle/http/parameters.rb', line 16

def add(name, options = {})
  @items.push(
    name: name.to_sym,
    required: options[:required] == true,
    alias: options[:alias]
  )
end

#requiresObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



26
27
28
29
# File 'lib/fugle/http/parameters.rb', line 26

def requires
  @requires ||=
    @items.select { |item| item[:required] }
end