class Elibri::ONIX::Dict::Release_3_0::Base

Klasa podstawowa dla wszystkich słowników ONIX`a

Attributes

const_name[R]
name[R]
onix_code[R]
onix_doc[R]

Public Class Methods

all() click to toggle source
# File lib/elibri_onix_dict/onix_3_0/base.rb, line 52
def self.all
  self.const_get(:ALL) # Wartość stałej 'ALL' pobierz dynamicznie - z klasy pochodnej...
end
all_except(*onix_codes) click to toggle source

Zwróć listę wszystkich elementów słownika, poza tymi o kodach przekazanych jako argument

# File lib/elibri_onix_dict/onix_3_0/base.rb, line 62
def self.all_except(*onix_codes)
  onix_codes.flatten!
  self.all.reject {|dict_item| onix_codes.include?(dict_item.onix_code) }
end
by_const_names(const_names) click to toggle source

zwróć wszyskie wartości o określonych const_names

# File lib/elibri_onix_dict/onix_3_0/base.rb, line 57
def self.by_const_names(const_names)
  self.all.find_all { |value| const_names.include?(value.const_name) }
end
find_by_onix_code(searched_onix_code) click to toggle source
# File lib/elibri_onix_dict/onix_3_0/base.rb, line 47
def self.find_by_onix_code(searched_onix_code)
  self.all.find {|dict_item| dict_item.onix_code == searched_onix_code }
end

Public Instance Methods

method_missing(method_name, *args) click to toggle source
Calls superclass method
# File lib/elibri_onix_dict/onix_3_0/base.rb, line 30
def method_missing(method_name, *args)
  if args.empty?
    if method_name.to_s =~ /\?$/
      mn = method_name.to_s.gsub("?", "")
      if instance_variable_defined?("@#{mn}")
        value = instance_variable_get("@#{mn}")
        if value.is_a?(TrueClass) || value.is_a?(FalseClass)
          return value
        end
      end
    elsif instance_variable_defined?("@#{method_name}")
      return instance_variable_get("@#{method_name}")
    end
  end
  super
end
onix_doc?() click to toggle source
# File lib/elibri_onix_dict/onix_3_0/base.rb, line 26
def onix_doc?
  onix_doc
end