Class: Saru::Builder
- Inherits:
-
Object
- Object
- Saru::Builder
- Defined in:
- lib/saru/builder.rb
Constant Summary collapse
- TYPES =
%w(radical kanji vocabulary)
Instance Attribute Summary collapse
-
#levels ⇒ Object
readonly
Returns the value of attribute levels.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(type, levels = nil) ⇒ Builder
constructor
A new instance of Builder.
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
#levels ⇒ Object (readonly)
Returns the value of attribute levels.
10 11 12 |
# File 'lib/saru/builder.rb', line 10 def levels @levels end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
10 11 12 |
# File 'lib/saru/builder.rb', line 10 def type @type end |
Instance Method Details
#call ⇒ Object
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 |