Class: Fleakr::Api::Option
- Inherits:
-
Object
- Object
- Fleakr::Api::Option
- Defined in:
- lib/fleakr/api/option.rb
Overview
Option
Top-level class for creating specific option instances based on type
Constant Summary collapse
- MAPPING =
{ :tags => 'TagOption', :viewable_by => 'ViewOption', :level => 'LevelOption', :type => 'TypeOption', :hide? => 'HiddenOption' }
Class Method Summary collapse
-
.class_for(type) ⇒ Object
:nodoc:.
-
.for(type, value) ⇒ Object
Initialize a new option for the specified type and value.
Class Method Details
.class_for(type) ⇒ Object
:nodoc:
24 25 26 27 |
# File 'lib/fleakr/api/option.rb', line 24 def self.class_for(type) # :nodoc: class_name = MAPPING[type] || 'SimpleOption' Fleakr::Api.const_get(class_name) end |
.for(type, value) ⇒ Object
Initialize a new option for the specified type and value
20 21 22 |
# File 'lib/fleakr/api/option.rb', line 20 def self.for(type, value) class_for(type).new(type, value) end |