Class: Ravelry::PatternType

Inherits:
Object
  • Object
show all
Defined in:
lib/ravelry/pattern_type.rb

Overview

The information used to create ‘Ravelry::PatternType` objects comes from Pattern objects.

See Pattern for more information about ‘Pattern` objects.

You should not create ‘PatternType` objects manually; they are all created–and owned–by a Pattern.

Note that there are other API endpoints for pattern categorization; this might not be the one that you’re looking for.

See Pattern for more information about ‘Pattern` objects.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ PatternType

Returns a new instance of PatternType.



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ravelry/pattern_type.rb', line 17

def initialize(type)
  @type = type

  # Ravelry vanity permalink for the type. Note: not a full URL.
  #
  @permalink = type[:permalink]

  # Name of the type.
  #
  @name = type[:name]
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



15
16
17
# File 'lib/ravelry/pattern_type.rb', line 15

def name
  @name
end

Returns the value of attribute permalink.



15
16
17
# File 'lib/ravelry/pattern_type.rb', line 15

def permalink
  @permalink
end

Instance Method Details

#clothing?Boolean

Boolean value; determins if category qualifies as clothing.

Returns:

  • (Boolean)


30
31
32
# File 'lib/ravelry/pattern_type.rb', line 30

def clothing?
  @type[:clothing]
end