Class: ClientEnumSource

Inherits:
Object
  • Object
show all
Defined in:
common/client_enum_source.rb

Instance Method Summary collapse

Constructor Details

#initializeClientEnumSource

Returns a new instance of ClientEnumSource.



6
7
8
9
10
# File 'common/client_enum_source.rb', line 6

def initialize
  MemoryLeak::Resources.define(:enumerations, proc {
                                 JSONModel::Client::EnumSource.fetch_enumerations
                               }, 300)
end

Instance Method Details

#default_value_for(name) ⇒ Object



30
31
32
# File 'common/client_enum_source.rb', line 30

def default_value_for(name)
  MemoryLeak::Resources.get(:enumerations)[:defaults].fetch(name)
end

#editable?(name) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
23
# File 'common/client_enum_source.rb', line 17

def editable?(name)
  if MemoryLeak::Resources.get(:enumerations).fetch(name).respond_to?(:editable?)
    MemoryLeak::Resources.get(:enumerations).fetch(name).editable?
  else
    false
  end
end

#valid?(name, value) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'common/client_enum_source.rb', line 13

def valid?(name, value)
  values_for(name).include?(value)
end

#values_for(name) ⇒ Object



26
27
28
# File 'common/client_enum_source.rb', line 26

def values_for(name)
  MemoryLeak::Resources.get(:enumerations).fetch(name)
end