Class: Ravelry::Printing

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

Overview

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

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

See Pattern for more information about ‘Pattern` objects.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(printing) ⇒ Printing

Returns a new instance of Printing.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/ravelry/printing.rb', line 13

def initialize(printing)
  @printing = printing
  @pattern_source = printing[:pattern_source]

  # Price of the printing source.
  #
  @price = @pattern_source[:price]

  # Permalink for printing.
  #
  @permalink = @pattern_source[:permalink]

  # Name of the printing.
  #
  @name = @pattern_source[:name]

  # Author of the printed source (if any).
  #
  @author = @pattern_source[:author]

  # URL of the printing.
  #
  @url = @pattern_source[:url]

  # Printing's rating on Amazon.
  #
  @amazon_rating = @pattern_source[:amazon_rating]

  # Number of patterns available in this printing.
  #
  @pattern_count = @pattern_source[:pattern_count]

  # Printing's Amazon URL.
  #
  @amazon_url = @pattern_source[:amazon_url]

  # Path to image, if any.
  #
  @shelf_image_path = @pattern_source[:shelf_image_path]

  # List price of the printing.
  #
  @list_price = @pattern_source[:list_price]
end

Instance Attribute Details

#amazon_ratingObject (readonly)

Returns the value of attribute amazon_rating.



11
12
13
# File 'lib/ravelry/printing.rb', line 11

def amazon_rating
  @amazon_rating
end

#amazon_urlObject (readonly)

Returns the value of attribute amazon_url.



11
12
13
# File 'lib/ravelry/printing.rb', line 11

def amazon_url
  @amazon_url
end

#authorObject (readonly)

Returns the value of attribute author.



11
12
13
# File 'lib/ravelry/printing.rb', line 11

def author
  @author
end

#list_priceObject (readonly)

Returns the value of attribute list_price.



11
12
13
# File 'lib/ravelry/printing.rb', line 11

def list_price
  @list_price
end

#nameObject (readonly)

Returns the value of attribute name.



11
12
13
# File 'lib/ravelry/printing.rb', line 11

def name
  @name
end

#pattern_countObject (readonly)

Returns the value of attribute pattern_count.



11
12
13
# File 'lib/ravelry/printing.rb', line 11

def pattern_count
  @pattern_count
end

Returns the value of attribute permalink.



11
12
13
# File 'lib/ravelry/printing.rb', line 11

def permalink
  @permalink
end

#priceObject (readonly)

Returns the value of attribute price.



11
12
13
# File 'lib/ravelry/printing.rb', line 11

def price
  @price
end

#shelf_image_pathObject (readonly)

Returns the value of attribute shelf_image_path.



11
12
13
# File 'lib/ravelry/printing.rb', line 11

def shelf_image_path
  @shelf_image_path
end

#urlObject (readonly)

Returns the value of attribute url.



11
12
13
# File 'lib/ravelry/printing.rb', line 11

def url
  @url
end

Instance Method Details

#out_of_print?Boolean

Boolean value. Is this resource out of print?

Returns:

  • (Boolean)


60
61
62
# File 'lib/ravelry/printing.rb', line 60

def out_of_print?
  @pattern_source[:out_of_print]
end

#primary_source?Boolean

Boolean value. Is this the primary source of the pattern?

Returns:

  • (Boolean)


66
67
68
# File 'lib/ravelry/printing.rb', line 66

def primary_source?
  @printing[:primary_source]
end