
#include "raspell.h"


static AspellDictInfo* get_info(VALUE info) {
    AspellDictInfo *result;
    Data_Get_Struct(info, AspellDictInfo, result);
    return result;
}

static VALUE dictinfo_s_new(int argc, VALUE *argv, VALUE klass) {
    rb_raise(rb_eException, "not instantiable");
}

static VALUE dictinfo_name(VALUE self) {
    return rb_str_new2(get_info(self)->name);
}

static VALUE dictinfo_code(VALUE self) {
    return rb_str_new2(get_info(self)->code);
}

static VALUE dictinfo_jargon(VALUE self) {
    return rb_str_new2(get_info(self)->jargon);
}

static VALUE dictinfo_size(VALUE self) {
    return INT2FIX(get_info(self)->size);
}

static VALUE dictinfo_size_str(VALUE self) {
    return rb_str_new2(get_info(self)->size_str);
}

void Init_dictinfo() {
    //CLASS DEFINITION=========================================================
    cDictInfo = rb_define_class("AspellDictInfo", rb_cObject);
    
    //CLASS METHODS============================================================
    rb_define_singleton_method(cDictInfo, "new", dictinfo_s_new, 0);

    //METHODS =================================================================
    rb_define_method(cDictInfo, "name", dictinfo_name, 0);
    rb_define_method(cDictInfo, "code", dictinfo_code, 0);
    rb_define_method(cDictInfo, "jargon", dictinfo_jargon, 0);
    rb_define_method(cDictInfo, "size", dictinfo_size, 0);
    rb_define_method(cDictInfo, "size_str", dictinfo_size_str, 0);
}

/**
 * raspell      September 2002      
 *
 * Copyright (c) aquanauten (resp: matthias_veit@yahoo.de)
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option) 
 * any later version.
 *  
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
 * GNU General Public License for more details.
 *  
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  
 * 02111-1307, USA.
 *
 */
