Class: Saper::Arguments::Recipe
Instance Method Summary
collapse
[], #action, exists?, inherited, #initialize, #mandatory?, new, #optional?, #set, subclasses, type, #value
Instance Method Details
#normalize(value) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/saper/arguments/recipe.rb', line 9
def normalize(value)
if value.is_a?(Recipe)
return value
end
if value.is_a?(String)
value = value.to_sym
end
unless value.is_a?(Symbol)
raise InvalidArgument
end
if action.nil?
raise NamespaceMissing
end
if action.namespace.nil?
raise NamespaceMissing
end
unless value = action.namespace[value]
raise ActionNotFound
end
value
end
|
#serialize ⇒ Object
32
33
34
|
# File 'lib/saper/arguments/recipe.rb', line 32
def serialize
value.id
end
|
#to_string ⇒ Object
36
37
38
|
# File 'lib/saper/arguments/recipe.rb', line 36
def to_string
value.id.inspect
end
|
#valid?(value) ⇒ Boolean
5
6
7
|
# File 'lib/saper/arguments/recipe.rb', line 5
def valid?(value)
value.is_a?(Symbol) || value.is_a?(String)
end
|