Class: Saru::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/saru/builder.rb

Constant Summary collapse

TYPES =
%w(radical kanji vocabulary)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, levels = nil) ⇒ Builder

Returns a new instance of Builder.



12
13
14
15
# File 'lib/saru/builder.rb', line 12

def initialize type, levels = nil
  @type  = type
  @levels = levels
end

Instance Attribute Details

#levelsObject (readonly)

Returns the value of attribute levels.



10
11
12
# File 'lib/saru/builder.rb', line 10

def levels
  @levels
end

#typeObject (readonly)

Returns the value of attribute type.



10
11
12
# File 'lib/saru/builder.rb', line 10

def type
  @type
end

Instance Method Details

#callObject

Raises:

  • (ArgumentError)


17
18
19
20
21
# File 'lib/saru/builder.rb', line 17

def call
  raise ArgumentError, 'Not valid type' unless TYPES.include?(type)

  build
end