Class: SimplerTiles::Style

Inherits:
Object
  • Object
show all
Includes:
PP
Defined in:
lib/simpler_tiles/style.rb,
ext/simpler_tiles/style.c

Overview

Each style defines a particular directive for styling the map. For a list of keys and arguments refer to the simple-tiles documentation.

Instance Method Summary collapse

Methods included from PP

#inspect

Constructor Details

#initialize(key, arg) ⇒ Style

Construct a new style



8
9
10
11
# File 'lib/simpler_tiles/style.rb', line 8

def initialize(key, arg)
  self.key = key
  self.arg = arg
end

Instance Method Details

#argString

Get the arg for this Style.

Returns:

  • (String)


57
58
59
60
61
62
63
# File 'ext/simpler_tiles/style.c', line 57

static VALUE
get_arg(VALUE self){
  simplet_style_t *style = get_style(self);
  char *arg;
  simplet_style_get_arg(style, &arg);
  return rb_str_new2(arg);
}

#arg=(arg) ⇒ String

Set the arg for this Style.

Parameters:

  • (String)

Returns:

  • (String)


43
44
45
46
47
48
49
# File 'ext/simpler_tiles/style.c', line 43

static VALUE
set_arg(VALUE self, VALUE arg){
  Check_Type(arg, T_STRING);
  simplet_style_t *style = get_style(self);
  simplet_style_set_arg(style, RSTRING_PTR(arg));
  return arg;
}

#keyString

Get the key for this Style.

Parameters:

  • (String)

Returns:

  • (String)


85
86
87
88
89
90
91
# File 'ext/simpler_tiles/style.c', line 85

static VALUE
get_key(VALUE self){
  simplet_style_t *style = get_style(self);
  char *key;
  simplet_style_get_key(style, &key);
  return rb_str_new2(key);
}

#key=(key) ⇒ String

Set the key for this Style.

Parameters:

  • (String)

Returns:

  • (String)


71
72
73
74
75
76
77
# File 'ext/simpler_tiles/style.c', line 71

static VALUE
set_key(VALUE self, VALUE key){
  Check_Type(key, T_STRING);
  simplet_style_t *style = get_style(self);
  simplet_style_set_key(style, RSTRING_PTR(key));
  return key;
}